Quote:
Originally Posted by Daedalus
Even coordinates can be unbundled to save some checks - there's no point comparing the Y coordinates if the X coordinates aren't within collision range, for example. Compare the short side of the hitbox first and you'll eliminate more redundant checks.
If you're actually using sprites, there's hardware collision detection available which is more or less for free on real hardware (though it's CPU-intensive to do under emulation) - it's one advantage of using sprites versus blitting.
|
All my hitboxes are perfect 16x16 squares, but of course your suggestion makes sense. If you look at my code, I first check x coordinates and only if they are correct I check y coordinates.
Sprite vs Sprite collision is great and very fast indeed. Unfortunately it's not the case here.. sprite vs Playfield collision only tells me a collision happened, not where did it happen, so you have to do the checks anyway.
Also about sprite X sprite collision, each pair of sprite channels share collision detection too. If you check sprite Channel 0 against, say, sprite 7, a collision between sprite 1 against 6 will return a positive too.