Hi all
Im having a problem where my script wont take away health by my player if it is hit by the enemy bullet, the script has been placed on my character and when hit with anything with the Tag "enemyBullet" it should take health away from my character.
Thanks for any help you can offer.
I am a complete noob at this so if you are going to offer advice please try explain it as simply as possible. Thanks!
pragma strict
var health : int = 100;
var damage : int = 20;
var whiteStencilGui : GUISkin;
function Start () {
}
function Update () {
}
function OnCollisionEnter (collision : Collision)
{
if(collision.collider.tag == "enemyBullet")
{
health = health - damage;
}
}
function OnGUI()
{
GUI.skin = whiteStencilGui;
GUI.Box (Rect (Screen.width-100, 10, 100, 50), "health:" +health);
}
![alt text][1]
[1]: /storage/temp/33573-lastchance.jpg
↧