Next, a question about collisions
Posted: Mon Feb 17, 2014 1:08 am
Next problem I have encountered is about collisions. I want to have an object do different things depending on which object it collides with.
For example, if the player hits an enemy, I want the player to be removed, but if it hits a score item I want to increase a score variable. Problem is, whichever happens, the game now registers a collision and both triggers. I can't move the collision code to the enemy or score models, since then the problem would just be moved one step. (Since player still has collided with something.) It's a bit hard to explain, but I hope I make sense.
Also, can collisions be local somehow. For example, set for each model under Definitions? Or do they have to be set at OnLoaded? I tried the former, but it didn't seem to work.
Any idea on how to go about this?
For example, if the player hits an enemy, I want the player to be removed, but if it hits a score item I want to increase a score variable. Problem is, whichever happens, the game now registers a collision and both triggers. I can't move the collision code to the enemy or score models, since then the problem would just be moved one step. (Since player still has collided with something.) It's a bit hard to explain, but I hope I make sense.

Also, can collisions be local somehow. For example, set for each model under Definitions? Or do they have to be set at OnLoaded? I tried the former, but it didn't seem to work.
Any idea on how to go about this?