View Single Post
Old 26 July 2014, 21:17   #6
Photon
Moderator

Photon's Avatar
 
Join Date: Nov 2004
Location: Eksjö / Sweden
Posts: 4,819
Just wanted to say that for games, sprite collision registers seem to go largely unused. There are many reasons. Sprite collision is pixel-perfect and sometimes you want something more forgiving, or simply collide only the "main body" of an object, even if pixels are set outside the body in the sprite. Also, using it forces you to use sprites for the colliding object, and in many games there aren't enough sprites to go around, or objects are larger than sprites. AGA allows bigger sprites, so there it may possibly be of more use, but still, using sprites enforces some limitations you'll overcome by using bobs instead, and so that's what many use, not sprites.

Also, a fast moving sprite like a bullet might "skip past" another sprite like a spaceship, or at least the corner of it, where in fact the spaceship was in the bullet's path and should have exploded. This is especially true if the frame rate is less than 50 FPS. And so the programmers, if they used sprites for both, would still have to write a separate collision routine from coordinates and hitboxes.

In short, sprite collision is pretty much useless except in rare special cases, and hitboxes is the way to go. You can also do pixel-perfect collision detection from the bob outlines. Then you could use hitboxes as a quick-check to decide whether you need to spend time blitting to check pixels.

Another bonus from not using sprite collision is that you won't have to wait for the collision bit to be set, but can just check if two objects collide anytime and make decisions in the right place in the game code.
Photon is offline  
 
Page generated in 0.04184 seconds with 11 queries