Highscore

Get help using Construct 2

Post » Thu May 31, 2012 6:13 pm

I am trying to save the Highest Score for a player via Webstorage. The problem I am having though is that I don't want the player's score to overwrite the Highest Score unless the score is actually higher than the Highest Score value.

So say the player is playing the game and on the first run through, they get 20 points. I want to save this to webstorage (I can do this no problem).

Say the player plays again and gets 25 points. I want this to save to webstorage.

If the player plays again but only gets 15 points, I do not want it saved to webstorage because it is less than the 25 previously earned - basically I want to keep track of the player's absolute highest score.

I am having difficulty doing this. Any tips would be quite welcome! Thank you.
B
19
S
6
G
5
Posts: 98
Reputation: 4,484

Post » Thu May 31, 2012 10:23 pm

if highscore > webstorage.localvalue("highscore")
set webstorage local value key "highscore' value highscore
B
90
S
30
G
24
Posts: 3,189
Reputation: 32,400

Post » Fri Jun 01, 2012 2:18 am

Oh, huh, I didn't know you could use the webstorage local value as a thing like that for comparison. I will give that a shot. Thank you kindly.
B
19
S
6
G
5
Posts: 98
Reputation: 4,484

Post » Wed Aug 08, 2012 12:00 pm

I want to make the same for my game, but i can`t even save the highscore at first place. I have 1 Global Variable called "Timelim" thats also the highscore. If i finish the game in 50 seconds for example, the highscore need to be 50, if i finish it in 48 the highscore will need to automatically update to 48. I do this and no result...so i have game event and menu event, in the meny event i have placed this.



Please help, after the main thing is done i think i can do the rest with this

if highscore > webstorage.localvalue("highscore")
set webstorage local value key "highscore' value highscore

I really like construct 2 and learned everything, but i can`t understand this webstorage...

Thanks
B
10
S
3
G
3
Posts: 54
Reputation: 3,317

Post » Sun Sep 02, 2012 10:03 pm

if highscore > webstorage.localvalue("highscore")
set webstorage local value key "highscore' value highscore

In my case i need it the other way, first method works, second doesn`t, i can`t understand why. I can`t understand many things in construct, maybe i am dumb.

if highscore < webstorage.localvalue("highscore")
set webstorage local value key "highscore' value highscore
B
10
S
3
G
3
Posts: 54
Reputation: 3,317


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 24 guests