Jump to content
IGNORED

How can you build a collisons counter here?


Recommended Posts

Hi good afternoon.
How can you build a collisons counter here?
Thank you.
greeting
  x=50
  y=50
 
  COLUBK=200
 
main
    
  if collision(player1,player0) then COLUBK=$28 else COLUBK=200
 
  COLUPF=214
 
  COLUP0=128
  COLUP1=64
 
  player0:
%00011100
%00011000
%00011000
%00100000
%01011010
%01111100
%00100100
%00010000
%00011000
%00111100
%00011000
end
 
  player1:
%00011100
%00011000
%00011000
%00100000
%01011010
%01111100
%00100100
%00010000
%00011000
%00111100
%00111100
end
 
  player0x=x
  player0y=y
 
player1x=80
  player1y=30
 
  drawscreen
 
  if joy0right then x=x+1
  if joy0left then x=x-1
  if joy0up then y=y-1
  if joy0down then y=y+1
 
  goto main

 

post-31221-0-97357100-1490352134_thumb.jpg

Link to comment
Share on other sites

  • 2 weeks later...

This should be quite simple.

 

You can add another variable where you currently have have y=50 add a new variable. For example:

 

i=0 : rem Used to count collisions.

 

where you test for collision in this line.

 if collision(player1,player0) then COLUBK=$28 else COLUBK=200

You should adjust that line to increment your counter.

if collision(player1,player0) then i=i+1

That would be a simple way to do it.

 

I hope that points you in the right direction.

 

Joe

 

 

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...