Guys, I have a enemy with 2 animations, one is when he is acting normally (tag = principal [[I’m Brazilian]]), and another called ‘‘hit’’.
But what happens is that only the ‘‘principal’’ animation is started, and when I collide with the enemy [it have a box collider], he doesn’t go away, and the ‘‘hit’’ animation isn’t even started. My friend told me to use a var=boolean, but I have no ideia of how do I use.
This is the code
.
#pragma strict
function Start () {
}
function Update () {
animation.Play("Principal");
}
function OnCollisionEnter(collision: Collision)
{
if (collision.gameObject.tag == "Player")
{
animation.Play("Hit");
Destroy(gameObject, 3);
}
}
Thnks guys, and sorry for my horrible English... I'm Brazilian