How do I Save a High Score after a Reset

0 favourites
  • 11 posts
From the Asset Store
Match the similar cards with each other and free all animals!
  • Hi,

    I have implemented a high score in my game using local storage.

    When a game ends and I press "S" to start a new game a load save state is initiated. When this happens the On Item Exist condition is for some reason not being met causing the high score to not continue into the next game.

    However, if I close the game and start fresh without a reset the On Item Exists condition IS MET and the high score is displayed...That is until I start a new game.

    Anyone have advice I would appreciate it!

    https://www.dropbox.com/s/b6jgqwbzol8ha ... .capx?dl=0

    Thanks

    Philip

  • Instead of loading your savegame slot "reset" restart the layout. You save your "reset" slot after the checking the localstorage item then when you load it, the item is never check and the trigger (event 3) is inactive

  • Hey Madspy!

    Thanks for the reply.

    Unfortunately, the load state is there in order to regenerate the shields at the start of a new game.

    In Object Type Properties Shields had to be set to a Global YES. This way the shield damage continues into the next level.

    Then on restart by hitting "S" it needs to load a save state to regenerate the shields.

    Also, I tried putting a play sound in event 1 to ensure it was getting to the load Check Item "HighScore" exists. And it does play the sounds, so in theory it should seeing HighScore exists.

    Philip

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What I maybe need to do is figure out a way to leave my shields Object Type Properties Shields set to a Global YES but find a way to make them regenerate on a new game by another means than a load state.

    Any ideas?

    p

  • Maybe some sort of array would help?

  • Anyone have any ideas?

    Thanks

  • Anyone have any ideas?

    Thanks

    Hi I made the official Highscore tutorial its located here

    https://www.scirra.com/tutorials/5343/h ... -game-capx

    The capx. file is also included let me know if you need any help.

  • Hi PixelPower

    I used your tutorial to set my high score up, thanks it's great

    unfortunately, in my circumstance it doesnt work

    Any ideas?

  • As you reset all global variable when you hit S to restart, the shield object don't have to be set as global so restart the layout instead of reloading your "reset" slot reload the shield and load the highscore

  • The shields have to stay on global so that the damage is retained into round 2

    If I set shields to a global NO the shield will regenerate through each new stage

  • Hi PixelPower

    I used your tutorial to set my high score up, thanks it's great

    unfortunately, in my circumstance it doesnt work

    Any ideas?

    Download the capx file in my tutorial. Its on the upper right of the screen powerkong capx. Open it and look at the code you must have missed a step somewhere because my game is similar to yours.

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