Scoring system that returns to previous score if you die?

User1111

  • Posts: 2
I have a basic score counter for a game I'm making as a group project finished. What I want to know now is how to do this:

After the player completes level 1, the score they had is saved somewhere. If the player fails level 2, then level 2 restarts and the score from the end of level 1 is retrieved.

Thanks

dreph

  • Posts: 140
The easiest approach for this is to store these scores as two attributes.  You can have a currentScore attribute and a lastScore attribute.

Have the lastScore be a game attribute, and the currentScore attribute as the score value that is tracked.  At the end of each level, set lastScore to currentScore, then if they die or have to restart, make sure the scene sets currentScore to lastScore attribute.

That should do it. :)

User1111

  • Posts: 2
I have an idea of what I'm supposed to do now, but I still don't know what exactly I have to do with the blocks to make it happen. Could someone explain with even more detail?

NerdinaNutshell

  • *
  • Posts: 112
Use two global attributes and ONLY UNTIL after the player completes level one set the global attribute to that score. When they die in level 2 set the score back to the global attribute
Plot Twist... I'm a ghost