play a death animation when a the gameobject is destroyed But Please I want it JS Script
Thats My Script and when i kiil my enemy its not playing the animation !
pragma strict
var Health = 100; var animDie : AnimationClip; // Drag your animation from the project view in here (to inspector)
function ApplyDammage (TheDammage : int) { Health -= TheDammage; if(Health <= 0) { Dead(); } }
function Dead()
{
GetComponent.<Animation>().Play(animDie.name);
Destroy(this.gameObject, animDie.length);
}
Comment
Your answer
Follow this Question
Related Questions
How to stop Enemy when dead 2 Answers
How do I make it so a death animation will play when I hit an enemy? 0 Answers
Animation Help? (2D) 1 Answer
Enemy Animation Play 0 Answers