Enemy character disappears as soon as i hit play
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
Your answer
Follow this Question
Related Questions
Why is this script not working? 2 Answers
OnCollisionEnter2D not working, Again! 0 Answers
Player takes damage through collider tag 0 Answers
How do i deal damage with raycasts in UNET? 0 Answers
Damage not working properly 1 Answer