How do I create Local High Scores

Get help using Construct 2

Post » Thu Sep 04, 2014 10:02 pm

I read the tutorials but can't seem to apply it for my own game. Here are the events for the page.

Image
B
4
Posts: 19
Reputation: 288

Post » Fri Sep 05, 2014 5:50 am

B
159
S
27
G
17
Posts: 916
Reputation: 32,664

Post » Fri Sep 05, 2014 5:59 am

Line3 and Line4 are probably comparing a string to integer, this wont work. Use this instead (only if your Score variable is integer):

Condition
[System: Compare two values] int(webstorage.localvalue("HighScore")>Score

Or use:
Compare Key value (as number)

See whether that helps.
B
28
S
8
G
4
Posts: 553
Reputation: 4,924

Post » Sat Sep 06, 2014 4:11 am

I've look at the youtube link, and used it as a reference.
@DuckfaceNinja: At first I had it set to Compare Key Value (as number) so I changed it to the first option you gave me. The problem still seems persistent. The actual score appears but it doesn't get registered as the high score when its played for the first time. It is constantly blank no matter how many games are played.
B
4
Posts: 19
Reputation: 288

Post » Sat Sep 06, 2014 5:25 am

Remove the action "set local key "HighScore" to 0" at the "on start of layout" condition !
Make a ( local key "HighScore" does not exist > set local key "HighScore" to 0 ) instead!
Also the line 3 condition should should check if the score is greater than the highscore and not otherwise.
B
18
S
4
Posts: 87
Reputation: 1,199

Post » Sat Sep 06, 2014 2:27 pm

I have something like this so far

Image


& heres what occurs

Image

13 would be my score for that current game but it doesnt register it as the highest score
B
4
Posts: 19
Reputation: 288

Post » Sat Sep 06, 2014 3:19 pm

@Cuddle
You need to change WebStorage local key exists to does not exist as you are setting the value to 0
B
28
S
6
G
2
Posts: 86
Reputation: 3,267

Post » Sat Sep 06, 2014 3:58 pm

I don't have that choice. Unless its an actual line

Image
B
4
Posts: 19
Reputation: 288

Post » Sun Sep 07, 2014 7:23 am

Use local key exists and than right click and select invert, a red x should appear before it, this is what does not exist means.
B
18
S
4
Posts: 87
Reputation: 1,199

Post » Sun Sep 07, 2014 12:09 pm

Here this is how you load the HS Image
B
13
S
3
Posts: 101
Reputation: 1,238

Next

Return to How do I....?

Who is online

Users browsing this forum: AnD4D and 2 guests