by muff » Apr 21, 2005 @ 10:04am
lets say we want to check for collision between our player's ship with all the enemy bullets...
you first create a collision surface, then you 'blit' the bullets to that collision surface with a specific MaskId for each bullet (i.e. first bullet has MaskID 1, second has 2 etc)
then you do a collision check with your 'ship' graphic against this collision surface and it will return the MaskID of the first bullet that is touching your ship (or it will tell you nothing is touching the ship obviously) - note it returns the first collision, not ALL collisions
so now you know which specific bullet is touching your ship so you can remove it from the list, apply damage to the ship etc
------------------------
the colour of the masks is set to the MaskID as that's how it works - you wouldn't normally actually view the collision surface on screen, the 'colour' data is just the stored MaskID shown as a 'colour' on screen
hopefully that makes some sense
muff