I’m making a reaction game. But I can’t get the health to work.
Here are my scripts.
static var health = 0;
var gameover : GameObject;
function Start ()
{
health = 3;
}
function Update ()
{
if (health <= 0)
{
Time.timeScale = 0.0;
gameover.transform.position = Vector3(0,0,0);
}
}
------------------
function OnCollisionEnter (hit : Collision)
{
if (hit.gameObject.tag == "Doctor")
{
Debug.Log("hit");
Health.health--;
Handheld.Vibrate ();
Debug.Log("Damaged");
}
}
I have also tagged and layered my player as “Doctor” and my lasers as “Laser”
and made sure the layers are colliding with each other.
The laser gameObjects are quads and are animating, they have boxcolliders,
same thing with the doctor.
I have the health script in my health text object. and laser script on my every laser.
Help me please, I’m REALLY out of ideas.