highscore with local storage

1 favourites
  • 5 posts
From the Asset Store
Basic Plugins for Firebase Authentication, Realtime-Database, Firestore, Cloud Storage
  • Hello everyone,

    I've made an endless runner and it saves a highscore with local storage.

    I've checked a few tutorials here and as long as the game is open, it works great but when I close the game and then open again later, the highscore is back at zero.

    Does someone know what the problem is?

    Oh btw, I my eventsheets are something like this:

    On start of layout -> check item "highscore" exist

    On item "highscore" exist -> get item "highscore"

    on item "highscore" get -> set "highscore" Localstorage.ItemValue

    Score > highscore -> set item "highscore" to score.

    Thanks

  • [quote:qrv9rltk]On start of layout -> check item "highscore" exist

    On item "highscore" exist -> get item "highscore"

    on item "highscore" get -> set "highscore" Localstorage.ItemValue

    Score > highscore -> set item "highscore" to score.

    The last two events are wrong.

    Should be something like this:

    Variable LevelScore=0

    Variable HighScore=0

    On start of layout -> check item "highscore" exist

    On item "highscore" exist -> set Global Variable HighScore to Localstorage.ItemValue

    When level ends

    If LevelScore>HightScore -> Set HighScore=LevelScore ; LocalStorage Set item "highscore" to HighScore

  • alright thanks I'll give it a try

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • It still doesn't work

    As soon as I exit the game and open it again, the highscore is back at 0

  • Could you share your project or a screenshot of your events?

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)