I\'m currently working on a game where the start screen is level 0, the actual playable levels are levels 1-4, and the lose screen is level 5. My issue is with the lose screen.
When you lose the game and load scene 5, Your Lives
still are zero, so CharacterMovement.Lives == 0
will be true and you just load scene 5 repeatedly. If you look at your console I guess there is a lot of this is level 5
in that. You have to handle this situation.
You can do something like this:
void Update () {
if(Input.GetKeyDown(KeyCode.Return) && (CurrentLevel == 0)){
CurrentLevel = 1;
Application.LoadLevel (CurrentLevel);
}
if (CharacterMovement.Score == 10) {
CurrentLevel = 2;
CharacterMovement.Score = 11;
Application.LoadLevel (CurrentLevel);
}
if ((CurrentLevel != 5) && (CharacterMovement.Lives == 0)) { // Change this
isLost = true;
Debug.Log ("is now true");
CurrentLevel = 5;
Debug.Log ("current level is set to 5");
Application.LoadLevel (CurrentLevel);
}
if (CurrentLevel == 5) {
Debug.Log ("this is level 5");
if (Input.GetKeyDown(KeyCode.Tab)) {
Debug.Log ("tab is pressed");
}
}
}