Jump to content

Photo

How can you build a collisons counter here?


1 reply to this topic

#1 funkheld OFFLINE  

funkheld

    Chopper Commander

  • 214 posts

Posted Fri Mar 24, 2017 4:42 AM

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
 

 

Attached Thumbnails

  • Bild234.jpg


#2 arkleyjoe OFFLINE  

arkleyjoe

    Combat Commando

  • 2 posts

Posted Tue Apr 4, 2017 6:45 AM

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

 

 






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users