help me my unity says operator ‘<’ can not be used with the left hand side of type ‘object’ and the right hand side of type ‘int’ … here is the javascript
I am wanting to make the character die when hp reach zero
1449680–78297–$atributos.js (283 Bytes)
Declare the type of variable as well : int
#pragma strict
static var _hp : int;
static var _hpEnd : int;
function Start () {
_hpEnd = 100;
_hp =_hpEnd;
}
function Update () {
if(_hp < 0)
{
Dead();
}
}
function OnGUI ()
{
GUI.Label(Rect(50,10,100,100),"HP"+_hp+"/"+_hpEnd);
}
function Dead() {
Application.LoadLevel("01");
}