i want it to work but this code doesn’t work, why?
here’s the code:
public int HEALTH=100;
static public int bulletDamage = 25;
static public bool soldierLives=true;
//public GameObject clavicle;
public GameObject soldier;
void OnCollisionEnter(Collision other)
{
if(other.gameObject.tag == "bullet")
{
Debug.Log (HEALTH);
HEALTH = HEALTH - bulletDamage;
Debug.Log (HEALTH);
}
}
void Update()
{
Debug.Log(HEALTH);
if (HEALTH<=0)
{
//clavicle.transform.parent = soldier.transform;
animation.Play("soldierDieFront");
Destroy(soldier,Time.deltaTime*20);
soldierLives = false;
}
}
}