How to save high score? file provided

ohtukrwohtukrw Sir dogeMember Posts: 106

When my hero loses all lives, the score points reset to 0.

There is no problem saving the highscore before the score points are reset, however after that, the highscore doesn't update.

Please help.

http://www104.zippyshare.com/v/gidKu3CD/file.html

Comments

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    On your second scene, you're changing the score back to 0 when lives reach 0. On your first scene, you're checking to see if the score is greater than the high score. Do you see the problem now? The score is already 0 before you change back to the first scene. You need to check the high score immediately after you change the score each time on the second scene.

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • ohtukrwohtukrw Sir doge Member Posts: 106

    @tatiang said:
    On your second scene, you're changing the score back to 0 when lives reach 0. On your first scene, you're checking to see if the score is greater than the high score. Do you see the problem now? The score is already 0 before you change back to the first scene. You need to check the high score immediately after you change the score each time on the second scene.

    Is it possible to update the high score, every time the score value changes? Unless I would need to reset my games points somehow else? I am lost in this one. I am creating a normal game, this was just logic behind it. :blush:

  • ohtukrwohtukrw Sir doge Member Posts: 106

    How are you guys saving your highscores? Or are you just showing the leaderboards? Wouldn't be any sense of achievement without them. :smile:

  • tatiangtatiang Member, Sous Chef, PRO, Senior Sous-Chef Posts: 11,949

    @ohtukrw said:
    Is it possible to update the high score, every time the score value changes?

    Yes:

    When touch is pressed
         Change Attribute game.score to game.score + 100
         When attribute game.score > game.highScore
              Change attribute game.highScore to game.score
              Save Attribute game.highScore [key]

    New to GameSalad? (FAQs)   |   Tutorials   |   Templates   |   Greenleaf Games   |   Educator & Certified GameSalad User

  • ohtukrwohtukrw Sir doge Member Posts: 106

    @tatiang said:

    @ohtukrw said:
    Is it possible to update the high score, every time the score value changes?

    Yes:

    When touch is pressed
         Change Attribute game.score to game.score + 100
         When attribute game.score > game.highScore
              Change attribute game.highScore to game.score
              Save Attribute game.highScore [key]

    Nice one :blush:

  • NNterprisesNNterprises Member, PRO Posts: 387

    I after every time I die in my games, I just do:

    If score is greater than high score (saved in table X)-
    -Change table value (high score in table x) to score
    -Save table

    Tables are easy because they save and load very simply

Sign In or Register to comment.