Parenting problem

Hey,

In my game, I parent and object to an enemy. I made so that when the enemy has a certain hp he disappears (end object). The problem is that the obejct parented to the enemy is also deleted that way. I tried to unparent it when the enemy is killed, but the object deletes before it unparents itself.

Please help me. :stuck_out_tongue:

If you using logic bricks, make sure the “end object” actuator is placed AFTER the “remove parent” actuator in the actuator list.
If you are using Python, it is the same call removeParent() before endObject().

I hope it helps

Sorry forgot to tell.

The enemy is deleted, and sends a messege to the Object. When the messege is recieved, it unparents itself.

So you better send a message to both object. When receiving the message, the child unparents, the parent deletes itself.

or:

write a script that unparents all of the objects children and ends itself:

own = GameLogic.getCurrentController().owner
for child in own.children:
        child.removeParent()

own.endObject()

should do the trick