[WebStorage] saving high score Locally...

Get help using Construct 2

Post » Fri Aug 01, 2014 7:56 am

I am needing to save the "High Score" text to save on Chrome and an Android app, so when a player starts the game back up, he will still have his previous High Score.
I have tried numerous techniques with WebStorage, but just cannot seem to get it to work correctly.
I understand that I need to save the Global Variable "HighScore" locally, but I can't seem to figure it out.
I have read and watched all the tutorials I can find. Most of the WebStorage tutorials save different things, but not the high score, and the ones that do show the high score being saved, show it being done with a "top 10 high score" using an array and WebStorage. I am not needing to do that. PLEASE HELP!!! I am a noob at construct but I am loving the learning curve!
I am using three layouts: Start, Game, Game Over. I am only needing the high score to appear on the Game Over layout.

Here is my Global Variables for score and what-not:
gamescreen3.png


Here is my Event Sheet for my Game Over Layout:
gamescreen2.png


And here is a simple screenie of the Game Over layout being tested in my browser"
gamescreen1.png


Thanks in advance, and if you have tips to offer me, please keep in mind that I am learning and don't understand too much.
You do not have the required permissions to view the files attached to this post.
B
39
S
11
G
4
Posts: 98
Reputation: 4,291

Post » Fri Aug 01, 2014 9:31 am

Here is an example capx i made for you.
https://dl.dropboxusercontent.com/u/108480585/webstorage.capx
It works as follows.
If there is already a "local key" called "my_games_highscore" it loads that value into the textbox.
if u click the button and the textbox is NOT empty it will set the "local key" called "my_games_highscore" to the value in the textbox.

I hope that helps.
B
6
S
1
Posts: 30
Reputation: 1,059

Post » Fri Aug 01, 2014 8:05 pm

@Naxos84 THANK YOU!! Not only did you help me out with my current problem, you gave me some awesome tips for other things I want to impliment later down the road! Thanks again!
B
39
S
11
G
4
Posts: 98
Reputation: 4,291


Return to How do I....?

Who is online

Users browsing this forum: draiza and 8 guests