GameSalad

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Resetting a score for every level after the 1st level

aquamonkeyaquamonkey Posts: 36Member, PRO

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 Posts: 1,610Member

    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 Posts: 36Member, PRO

    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.