Scoring system that returns to previous score if you die?

User1111

  • Posts: 4
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: 142
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: 4
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: 251
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
*Puff*

orbinho11

  • Posts: 13
Use global attributes and save your gae after the end of each level, when you fail the level, load the game. All global attributes will go back to the value it was saved.

User1111

  • Posts: 4
I know I have to use global attributes now, but how do I actually "get" the current score from the level when a level win triggers this event?

User1111

  • Posts: 4
Nevermind, just got it working. Thanks for all of your input.