I am making an FPS beginner level game, problem is that whenever i hit the play button, my enemy disappears (is killed automatically) after 1-2 seconds? i think it has something to do with the coding. i have actually made two javascript files, enemy health and bulletshoot.
**Enemy Health**
#pragma strict
var Health = 100;
function ApplyDammage (TheDammage : int)
{
Health -= TheDammage;
if(Health <= 0)
{
Dead();
}
}
function Dead()
{
Destroy (gameObject);
}
**Bulletshoot**
#pragma strict
var Dammage=50;
function OnCollisionEnter (info : Collision)
{
info.transform.SendMessage("ApplyDammage", Dammage,
SendMessageOptions.DontRequireReceiver);
Destroy(gameObject, 1);
}
function Update () {
var translation:float =Time.deltaTime*60;
transform.Translate(0,0,translation);
}
---------------------------------------------------------------------------------------
i cant seem to find out the problem, kindly help me out, please.
regards
↧