This site is no longer active and is available for archival purposes only. Registration and login is disabled.

Collision mask usage -newbie question


Collision mask usage -newbie question

Postby tremorJones » Apr 19, 2005 @ 10:42pm

I've recently started exploring gapidraw and I've been playing with the collision masks, and I feel there's something I'm just not getting: The mask ID assigned to a mask also sets its color. What I don't quite see is how this is useful in a game since, presumably one might want to set the color of a mask independently of the mask ID, so that you can match masks to elements of the game's graphics and still be able to differentiate between masks that have arbitrary colors or perhaps the same colors. I feel like I'm missing something big here. Can they be made invisible or something like that?
tremorJones
pm Member
 
Posts: 2
Joined: Apr 19, 2005 @ 10:25pm


Postby 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
muff
 


Postby tremorJones » Apr 27, 2005 @ 9:12pm

tremorJones
pm Member
 
Posts: 2
Joined: Apr 19, 2005 @ 10:25pm


Postby muff » Apr 27, 2005 @ 11:45pm

muff
 


Return to GapiDraw


Sort


Forum Description

The Cross-platform Graphics SDK for Palms, Pocket PCs, Symbian Devices, and Stationary PCs.

Moderators:

sponge, Johan

Forum permissions

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

cron