shuwand
[quote:2fvr1we3]How do I make highscore with localstorage ?
Add the LocalStorage object
Add global variables Score=0 and HighScore=0
Initialise your high score:
System: On start of layout
-> LocalStorage: Get item "HighScore"
LocalStorage: On item "HighScore" get
-> System: Set HighScore to int(LocalStorage.ItemValue)
In your level end event (where you'd show the high score and have a restart button), add a sub-event:
System: Compare Score > HighScore
-> System: Set HighScore = Score
-> LocalStorage: Set item "HighScore" to HighScore
[quote:2fvr1we3]why my highscore always NaN..
Use in() to turn the values returned from local storage into numbers, i.e. int(LocalStorage.ItemValue)