Let's say you have a missile object, tracking to your player object, and you want the missile to "kill" the player on contact, removing him from the game-space; How would you set that up? Well, there are different ways to do it (luckily), but the way that the logic-brick system was designed for, and that the current implementation promotes, is this:
- Set up a collision sensor on the player to detect the missile.
- Connect that with an "and controller".
- Connect the end of that controller to the Edit Object->End Object actuator.
Every death is a suicide.
Is that wrong? Well, I believe it is. Yes, it would be great if things worked like that in the real world, because then we could all just decide that every attempt on our life was a failure, be it an attempt of some specific enemy with a bazooka, or just of nature itself. But, in the BGE, I prefer my deaths to follow the cold hard logic of our current reality as closely as possible. The two primary reasons for my preference:
- It makes "real-world" sense, which is important for humans who developed their logic in the real world, and who now want to use that base of understanding in game design.
- It's better in an organizational sense.
Isn't it better to just have one missile that would "know" how to kill multiple objects?
In BGE python, every game object comes with an endObject() method, which, when executed, removes that object from the game space. This was a recent change in the API (I think), and a very useful one, because now you can just set a collision sensor on the missile object, use the hitObject attribute to get the object involved in the collision, and then subsequently kill it, by calling collision_sen.hitObject.endObject().
That's the way I do things, and that's the method I recommend.