Hi
Im trying to find a way to reload the level and lose one live
i used this function
function LivesR() {
lives -= 1;
}
and Application.LoadLevel(0) in function Update when health =0 ,but doesnt work propely , it revome 1 live but when the level is loaded again lives returns to 3.
Player_H_L Script
var health : int =100;
var lives : int=3;
var firstTime:float;
var timeInertval:float = 1;
function Update () {
if ( Time.time > firstTime + timeInertval){
Addhealth();}
if ( health >=100){
health = 100;}
if ( health <=0){
health = 0;
}
}
function SubHealth( damage : int ) {
health -= damage;
}
function SubLives() {
lives --;
}
function MyHealth(){
return lives;
}
function MyLives(){
return health;
}
function Addhealth(){
firstTime = Time.time;
health+=5;
}
Thanks for help