Resetting a score for every level after the 1st level

aquamonkeyaquamonkey Member, PRO Posts: 36

I figured out how to reset the score back to zero when retrying the 1st level, but how would you do this for the following levels, i.e., score 100, in level 1, then in level 2, score 140, but fail that level. When the retry button is pressed, level 2 should reset with a score of 100.

Comments

  • colandercolander Member Posts: 1,610

    Have an attribute for score and another one for levels i.e. levelScore and add the two when the level is complete or reset the level.Score to 0 if they fail.

  • aquamonkeyaquamonkey Member, PRO Posts: 36

    Thanks @colander‌! I thought of something similar that also works for me now. I wanted the score from previous levels to carry over, i.e. complete level 1 with a score of 100, then that's your score at the beginning of level 2. If level 2 fails, then the score is reset to 100 (the last recorded score). I have an integer attribute for LastLevelScore which is changed to game.score after each level is complete. If level 2 fails, then change game.score to game.LastLevelScore when player retries the level.

Sign In or Register to comment.