Quantcast
Channel: Questions in topic: "enemy"
Viewing all articles
Browse latest Browse all 1488

I use this script, but the enemy lose health if i don´t target him.

$
0
0
Can you sai me what can y add that makes that my script works well? There is my script var health2 : Texture2D; var health1 : Texture2D; var texturewidth : int; var textureheight : int; function OnTriggerEnter(other : Collider){ if(other.tag == "Player"){ TakeDamage = true; } } function OnTriggerExit(other: Collider){ if(other.tag == "Player"){ TakeDamage = false; } } function Update(){ if(TakeDamage){ if(Input.GetButtonDown("Fire1")){ health --; } } if(health <- -1){ health = 0; Debug.Log ("ENEMY DOWN!"); Destroy(gameObject); } if(health == 100){ Healthfull = true; } } function OnGUI(){ if(health == 3) { GUI.Label(Rect(10,40,texturewidth,textureheight),healthfull); } if(health == 2) { GUI.Label(Rect(10,40,texturewidth,textureheight),health2); } if(health == 1) { GUI.Label(Rect(10,40,texturewidth,textureheight),health1); } }

Viewing all articles
Browse latest Browse all 1488

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>