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
2
G
3
Posts: 27
Reputation: 2,319

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
44
S
18
G
18
Posts: 2,108
Reputation: 16,465

Post » Sun May 05, 2013 7:24 pm

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

Post » Mon May 06, 2013 12:18 am

Theres the new saving feature that will probably be a lot easier.
B
44
S
13
G
7
Posts: 603
Reputation: 7,936

Post » Mon May 06, 2013 2:09 pm

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


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 10 guests