How do I Save global variable highscore even exit the app

0 favourites
  • 4 posts
From the Asset Store
Globals 2.0
$3.99 USD
Globals 2.0 stores and group variables. You can also load and save data (variables) from/to JSON files.
  • Hi! I got a problem, I want to save the global variable highscore even exiting the app and I When I enter the game again show me the highscore I did before. I'm using localstorage to save the highscore. I using too Cocoon.io for the apk.

    Thank you!

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hi! I got a problem, I want to save the global variable highscore even exiting the app and I When I enter the game again show me the highscore I did before. I'm using localstorage to save the highscore. I using too Cocoon.io for the apk.

    Thank you!

    Use this event:

    This event is taking place in a single layout (example)

    Add 1 Global Variable named "HighScore"

    Note: In the event On item missing (We will create a LocalStorage key named "Highscore")

    On start of layout..

    ---->Local Storage Check for item ("Highscore")

    On Item found ("Highscore")

    • ---->Set value Highscore to (LocalStorage.Itemvalue)

    On Item missing ("Highscore")

    ------>Set LocalStorage Item ("Highscore") to 0

    On end of layout

    ------>Set LocalStorage item ("Highscore") to Highscore

  • That helps! Thanks, but now I have this problem, when I restart the layout the highscore show 2 values. <img src="{SMILIES_PATH}/icon_e_sad.gif" alt=":(" title="Sad">

    https://dl.dropboxusercontent.com/u/797 ... index.html

  • Solved

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