GameSalad

Howdy, Stranger!

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

How to save high score? file provided

ohtukrwohtukrw Sir dogePosts: 106Member

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 Posts: 11,907Member, Sous Chef, PRO, Senior Sous-Chef

    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 Posts: 106Member

    @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 Posts: 106Member

    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 Posts: 11,907Member, Sous Chef, PRO, Senior Sous-Chef

    @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 Posts: 106Member

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

    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.