Well im new here guys.
I want to tell you that I am making a game for the iphone and well I have some problems but the most important now is the health bar, here is the code:
// Player goes here:
var Warrior: GameObject;
//Here are the textures of the health
var Health1: Texture2D;
var Health2: Texture2D;
var Health3: Texture2D;
//Times Dead
var fall = 0;
//Some Code
function Update () {
// If the player falls, the healthbar will decrease
if(Warrior.transform.position.y < -2 )
{
gameObject.Find ("Health");
//Change the HealthBar
guiTexture.texture = Health2;
fall = 1; //Now the fall times increases to 1, untill here all is ok
}
}
if(Warrior.transform.position.y < -2 && fall == 1){
gameObject.Find ("Health");
//Change the HealthBar
guiTexture.texture = Health3;
}
Does anybody see a problem there?
My code does not has errors but the bar only decreases to Health2 if I fall again it doesnt decrease to Health3.
Some help?