How do I Stop High Score Resetting

0 favourites
  • 2 posts
From the Asset Store
High Low is a casino game using luck and points accumulation.
  • Hi everyone,

    Sorry for being a total noob, I know there are plenty of threads and tutorials on this (both official and unofficial). Trust me, I've read them all but I still cannot get my head around this.

    I'm trying to create a score and a high score, I've got the score to count points okay. When I restart the game I reset the score to 0. But then my High Score also does the same thing. It's not saving the high score, it seems to be just doing exactly what score is doing.

    I've set a global variable for HighScore and Score (both to equal 0). I have put the both in bold below to make it easier to read (hopefully).

    I've got a start page where the player presses play and the game begins. It is also the place where I would like to display the high score the player gets. Each time the player dies, it resets back to this page.

    On the start event page I've put:

    1 - System - On start of Layout - Check item "High Score" exists.

    2 - Local storage - On item "High Score" exists - Get Item "High Score"

    3 - Local storage - On item High Score get - set HighScore to localstorage.itemvalue

    - (local storage) - set item "High Score"

    to HighScore

    4 - System - On start of layout and when Score is more than or equal to HighScore

    - (system) - set HighScore to Score

    (local storage) - set item High Score to HighScore

    set text to "High Score" & HighScore

    I'm not sure if any of this info should be on the main event page instead (which is where I'm resetting it to 0). I'm also not sure if number 4 should be taking place at the start of this layout. I have tried puttint it at the end of the main game layout but I am not getting any change of results.

    Thanks in advance for any help!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • It's probably because High Score doesn't exist initially, and the first time you set it, Score has been reset to 0, so it sets HighScore to 0. You need to 'set HighScore to Score' before you reset Score to 0.

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