Jump to content

Photo

PM Collisions in Advan Basic


2 replies to this topic

#1 Bill246 OFFLINE  

Bill246

    Combat Commando

  • 5 posts

Posted Mon Mar 11, 2019 6:29 PM

I've been working with Advan Basic for a few months and really enjoy it.  The commands for player-missile graphics are much easier to use and faster than those in Atari Basic.  One part I can't figure out is collision detection.  The Advan Basic manual says the command T%=COLL(2%,16%) returns an integer whose value depends on whether or not player 2 has collided with other players.  This sort of works for me, but I still stuck on getting it to work properly.  What should the value of T% be if there is a collision?  If I PEEK location 53260, which I think is the collision status of player 0, it returns 12.  I want to do an IF statement where IF T% is the value of a collision, then do something.  What number should I look for?



#2 Rybags ONLINE  

Rybags

    Gridrunner

  • 16,089 posts
  • Location:Australia

Posted Wed Mar 13, 2019 3:12 AM

There's bitsettings that would reflect what the GTIA collision registers return.

 

So player collisions are bit 3 for Player 3, bit 2 for Player 2 etc.

Of course a player can't collide with itself so it's associated value never gets set.

 

Generally you'd look for a nonzero value then take further action.  Use an AND operation to filter the bits out further to see what other objects are involved.



#3 vitoco OFFLINE  

vitoco

    Moonsweeper

  • 343 posts

Posted Thu Mar 21, 2019 8:51 AM

Without trying Advan BASIC yet, I must say that whichever method you use to check for collisions, You must be sure that the screen frame was completely drawed, or the collision registers won't be modified. I usually clear the collision registers at the very beginning of a new frame, then wait for a complete redraw of the frame, probably using WAIT statement with a value of 0 or 1 as the argument, or by waiting for the value change of memory address 20 (RTCLOK).






0 user(s) are browsing this forum

0 members, 0 guests, 0 anonymous users