How to set up a clean death ?

Dornano 4 months ago in Melee updated by Marti (Lead Developer) 4 months ago 1

It may sounds obvious, but how do you do to set up the death of an enemy, or the Player, in your projects ?

Knowing that I want to keep the corpse (not destroy it) but I'm not using Ragdoll, since I far prefer to play an animation which sounds more natural to me.

Now, I have issue with my Player. When he attacks me and bring my life down to zero, a "death" state is played, the Player is not controllable anymore and a Game Over scene is about to load slowly. But if the enemy continue to attack me after I'm dead, my Player will stand up again, I don't know how to avoid that.

Same goes with the enemy's death. Using Melee, how can I play a "death" state and make him not moving anymore when his life is down to zero ?

Thanks for your help !

Unity version:
Game Creator version:

If you're using the Behavior module to control the enemy AI, you can create a Selector at the root of the graph and, on the left-most node, check if the player is dead (use a Local Variable of type Bool). If so, do nothing, as dead characters do nothing.

Do the same for the enemy, but you can also check if the player is dead. If it is, do not attack it and resume the patrolling (or stay still)

You'll need to put the necessary conditions checking how alive a character is.