Save only best scores? Capx. included.

Get help using Construct 2

Post » Thu Dec 20, 2012 9:12 pm

Ok, so i press play, finish the lvl in 7 seconds. In menu it says Score: 7, Highscore: 0, than i close the browser, and start the game from the beginning, finish the game in 9 seconds and in menu it shows Score: 9, Highscore: 0, i don`t see the problem solved here :), btw if you start directly in menu it shows Score:0, Hiscore: 0, so nothing is saved.


[QUOTE=wildmedia]
Create 2 global variables,
SCORE
BESTSCORE

when you run your game you will operate with the score(init with 0), and at the end of the game, compare score with bestscore, if score > bestscore then bestscore = score[/QUOTE]

i`ve tried this few months ago, but no result, maybe i missed something, if you think you can do it, pls fix the capx.


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

Post » Thu Dec 20, 2012 10:40 pm

WebStorage here by refered to as WS

Endgame event(however you judge it)
WS set localvalue "HighScore" =
WS.localValue("HighScore") < currentHighScore ? currentHighScore : WS.localValue("HighScore")

onLoad of layout or retrieving Highscore
set currentHighScore = WS.localValue("HighScore")
B
87
S
18
G
9
Posts: 2,455
Reputation: 14,834

Post » Fri Dec 21, 2012 12:39 am

I finally did it, thanks to "wildmedia" idea.

http://dl.dropbox.com/u/67937942/save%20best%20score.capx

btw best way to help someone is with capx, cause until you try it you can`t be certain it will work.

Thanks to all, problem is solved.legora2012-12-21 00:40:15
B
10
S
3
G
3
Posts: 54
Reputation: 3,317

Previous

Return to How do I....?

Who is online

Users browsing this forum: anty21ro, Baidu [Spider], dieblume86, Kagubro and 2 guests