hi! im a newbie here and im trying to create this game where in you got 3 tries and after that you return to the menu.
so after 1 try, i need to load the level again. and after 3 tries. i need to load the main level.
here’s my code. it tries again but never goes back to the main menu.
var levelToLoad: String;
var levelToLoadgo: String;
var beep: AudioClip;
static var tryagain : int = 1;
if(tryagain!=3){
audio.PlayOneShot(beep);
yield new WaitForSeconds(0.05);
Application.LoadLevel(levelToLoad);
}
if(tryagain>=3){
audio.PlayOneShot(beep);
yield new WaitForSeconds(0.05);
Application.LoadLevel(levelToLoadgo);
tryagain = 1;
}
in another script that handles time i got
stagegameover.tryagain++;
at the time over mark.