- Home /
Play animation once
I have a script in my game that does all the animations. In the Update function it checks to see if the health every drops to or below 0. When it does it disables the movement script and plays the death animation. The only problem is that the animation keeps playing as long as the health is still at 0. How can I make it so the animation plays once when I die and doesn't keep checking to see my health.
Comment
Best Answer
Answer by jtbentley · Sep 13, 2010 at 11:13 PM
Make an additional boolean check and trigger it when the player dies :)
if (health < 0 && !hasDied)
{
// Perform your death things
hasDied = true; // So this can't trigger again
}