Hiya!
So, I’ve run into this tiny problem, and I can’t really figure out how to get around it. (Well, I do have a workaround, but it’s not ideal…I’ll explain in a second.)
Ok…in my game, I’m constantly checking for collisions on the main display object. If something bad hits it—game over (or lose a life). If something good hits it (aka, a coin, or a health pack)—do the appropriate function. Basically, I’m checking at the time of collision to see what the name of the colliding object is, and then running an appropriate function based on that name.
It’s easy.
Only problem is that my main display object’s physics object is defined by multiple polygons (as brought in by Physics Editor). The issue this causes is that when something collides with it, there are actually a few collision events in very rapid succession. So, if I wanted to just say run a function that removes a life on collision, 6 lives could be removed near instantaneously. Not ideal.
I’ve gotten around this by using a collision counter, and using a few if statements (so, on collision, increase the collision counter…if it’s equal to 1, run the function). And then, after a short delay, I reset the collision counter back to zero. And this works. BUT…there are cases in which two legitimate collisions could occur really quickly, and using a small enough timer to delay the collision counter reset long enough/allow for fast collisions is kind of unreliable.
Not sure if any of that makes sense, but I guess what I’m really asking for is a good way to check on collision that it is the first collision between the two objects. Is that something that is easily done?
Thanks!
Logan [import]uid: 44896 topic_id: 18581 reply_id: 318581[/import]

