Webstorage

Get help using Construct 2

Post » Fri Feb 14, 2014 12:03 pm

Hi guys and gals, I have a problem with WebStorage, and my problem is that I cant get it to work... I read all posts but still dont know what Im doing wrong...

I have two local values, Score and HiScore. I want to save only the HiScore.

When Score > HiScore System Set HiScore to Score. (on the game layout)

I have 4 layouts, one for the menu, game, retry and credits.

- On the game layout I have this:

On end of layout, if Score is greater or equal than HiScore set Webstorage.LocalValue("HiScore")

- On the menu layout I have this:

Hishscore (text) on created, Set Text to "HiScore: " & HiScore
                             set local value HiScore to WebStorage.LocalValue("HiScore")

- And on the retry layout this:

Hishscore (text) on created, Set Text to "HiScore: " & HiScore
                             set local value HiScore to WebStorage.LocalValue("HiScore")


But nothing, what I am doing wrong? It dont quite understand it...
B
12
S
3
G
1
Posts: 79
Reputation: 1,055

Post » Fri Feb 14, 2014 12:08 pm

"    set local value HiScore to WebStorage.LocalValue("HiScore")"

Do > Set local value "HiScore" to HiScore

and to get the value back from the webstorage:

Do > Set Text to WebStorage.LocalValue("HiScore")
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Fri Feb 14, 2014 12:14 pm

Sorry Im still confused, could you please elaborate on that a little bit?
B
12
S
3
G
1
Posts: 79
Reputation: 1,055

Post » Fri Feb 14, 2014 12:18 pm

Where do I Do those things? On the first layout the player comes across? Or when the game ends?
B
12
S
3
G
1
Posts: 79
Reputation: 1,055

Post » Fri Feb 14, 2014 12:28 pm

When the game ends:

If Score>HiScore :
-Set Local Value "HiScore" to Score
-Set HiScore to Score

Ingame:

If Score>HiScore :
-Set HiScore to Score

When you begin the game:
On HighScore (the text object) created:
-Set Text to "HighScore : " & WebStorage.LocalValue("HiScore")

I think that will work
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Fri Feb 14, 2014 12:43 pm

Where it should display the number its blank. I dont understand it
B
12
S
3
G
1
Posts: 79
Reputation: 1,055

Post » Fri Feb 14, 2014 12:47 pm

Sent you a PM Aphrodite
B
12
S
3
G
1
Posts: 79
Reputation: 1,055

Post » Fri Feb 14, 2014 3:14 pm

Thanks Afrodite for the help. Im giving up, I hope GameCenter and Xcode will be able to resolve this without being so confusing.
B
12
S
3
G
1
Posts: 79
Reputation: 1,055


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 24 guests