Jump to content



1

DPC+ virtual collision detection


5 replies to this topic

#1 jbs30000 OFFLINE  

jbs30000

    Moonsweeper

  • 459 posts

Posted Thu Oct 20, 2011 4:46 AM

Apologies if I'm typing something you guys already know. I did lots of searching on virtual sprite collision detection and didn't find much so I did my own experiment.

I placed sprites 0 and 3 on the screen and then programmed the joystick to move sprite 0. I put, if collision(player0, player3) then reboot and every time they touched the program rebooted.

I changed all references from sprite 0 to sprite 5 and it still worked. This is awesome.

#2 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • 20,923 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Fri Oct 21, 2011 8:01 AM

So you're saying that collision detection is easier with DPC+ than with the old Multisprite Kernel? If so, that is awesome.

#3 jbs30000 OFFLINE  

jbs30000

    Moonsweeper

  • 459 posts

Posted Fri Oct 21, 2011 9:29 PM

I rarely used the old multisprite kernel, but I'm pretty sure that you couldn't use collision(playerx, playerx) for sprites 2 and above. So yeah, it's a lot easier than before.

#4 jbs30000 OFFLINE  

jbs30000

    Moonsweeper

  • 459 posts

Posted Fri Nov 4, 2011 3:54 AM

I just discovered something else. If you check for a collision between player0 and players 2-9 you'll get an accurate reading. If you check for a collision between player0 and player1, then any collision between player0 and players 1-9 will cause a collision and you'll have to narrow it down by doing other collision checks between player0 and players 2-9. Or check for other collisions first and place (player0, player1) last.

#5 Random Terrain OFFLINE  

Random Terrain

    Visual batari Basic User

  • 20,923 posts
  • Controlled Randomness
    Replay Value
    Nonlinear
  • Location:North Carolina (USA)

Posted Fri Nov 4, 2011 5:00 AM

View Postjbs30000, on Fri Nov 4, 2011 3:54 AM, said:

I just discovered something else. If you check for a collision between player0 and players 2-9 you'll get an accurate reading. If you check for a collision between player0 and player1, then any collision between player0 and players 1-9 will cause a collision and you'll have to narrow it down by doing other collision checks between player0 and players 2-9. Or check for other collisions first and place (player0, player1) last.

Thanks for the info.

#6 jbs30000 OFFLINE  

jbs30000

    Moonsweeper

  • 459 posts

Posted Fri Nov 4, 2011 11:25 PM

My final post about this. Disregard what I've been saying. I've done lots of tests and it doesn't work as simply as I thought. Depending on where the collision occurs, sometimes a collision between player0 and player2 registers as a collision between player0 and player2, other times it registers as a collision between player0 and player1.

I guess for now checking the x and y positions of sprites to see if there's any overlap is the way to go. At lease for bB version 1.1d.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users