LoginLogin
Nintendo shutting down 3DS + Wii U online services, see our post

Best way to do multiple collision checks on the same sprite?

Root / Programming Questions / [.]

Gaelstrom_ValenceCreated:
For use in say, a projectile that doesn't despawn upon hitting something, but rather can pierce and hit multiple enemies. I figure using a For loop and sphitsp(bullet,cnt) would be costly.

Unfortunately I think that's the best way to do it unless 12Me21 (or anyone else who is advanced) has a better way.

If you call SPHITSP(sprite id) once, you can keep calling SPHITSP() with no parameters to get other collisions by the same sprite. So if sprite #15 is colliding with sprites 10, 7, and 4, SPHITSP(15) returns 10, and SPHITSP() will return 7, then 4, then -1.

If you call SPHITSP(sprite id) once, you can keep calling SPHITSP() with no parameters to get other collisions by the same sprite. So if sprite #15 is colliding with sprites 10, 7, and 4, SPHITSP(15) returns 10, and SPHITSP() will return 7, then 4, then -1.
Ooohhhhhh, I always thought was detecting collisions from the most recently used SPCOL or something, thanks man!