How do I save position of sprite in webstorage

Get help using Construct 2

Post » Mon Apr 29, 2013 9:12 pm

Hi,
How can I save position of sprite in webstorage, is it possible? So it's in the same place when user comes back to the game, until he or she movies it again.
B
7
S
1
G
3
Posts: 27
Reputation: 2,169

Post » Mon Apr 29, 2013 9:27 pm

[QUOTE=roke] Hi,
How can I save position of sprite in webstorage, is it possible? So it's in the same place when user comes back to the game, until he or she movies it again.[/QUOTE]

You have to set 2 keys: "PlayerX" and "PlayerY" for exemple, in the local storage, set to the player X and Y respectively

then when you load the game (conditions of your choice, a button maybe), you begin the layout, and at the start, you set the X of the player equal to int(WebStorage.LocalValue("PlayerX")), and for the Y, the same but with the Y

the manual should help you too:

Webstorage
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
42
S
17
G
17
Posts: 2,098
Reputation: 15,865

Post » Sun May 05, 2013 7:24 pm

Thank you, I got it somehow working = )
B
7
S
1
G
3
Posts: 27
Reputation: 2,169

Post » Mon May 06, 2013 12:18 am

Theres the new saving feature that will probably be a lot easier.
B
40
S
12
G
7
Posts: 603
Reputation: 7,666

Post » Mon May 06, 2013 2:09 pm

Thanks about that too, that new feature looks good.
B
7
S
1
G
3
Posts: 27
Reputation: 2,169


Return to How do I....?

Who is online

Users browsing this forum: DannyBil, Exabot [Bot] and 1 guest