Question by
jack55c · Feb 04, 2017 at 04:53 PM ·
unity 5javascripthealthbar
I need help with my Healthbar.
Hello everyone. So I work on a HealthBar for my game, but I dont know how I can make the script recognize the image. The rest worked normally and it changed the Scene after I got hit 3 times. The only thing is, that it wont show it to me ingame. Thanks a lot in advance.
#pragma strict
var HP = 3;
var x = HP/3;
Update();
var reload : String;
var Content : String;
function OnTriggerEnter (Col: Collider)
{
if(Col.CompareTag ("Enemy"))
{
if(HP == 0)
{
Tod();
}
else
HP--;
}
}
function Tod()
{
Application.LoadLevel(reload);
}
function Update()
{
Content.fillAmount = x;
}
Comment