What does WebStorage actually do ?

Discussion and feedback on Construct 2

Post » Tue Jul 19, 2011 4:53 pm

Hi!

Im just curious on how I can use WebStorage in a game ? Is this going to remember the user IP or something and resume the game where he left it ?

Thanks
B
6
S
2
G
1
Posts: 122
Reputation: 1,194

Post » Tue Jul 19, 2011 9:39 pm

The web storage only stores the values you put in to it - it doesn't store the game state automatically. You can make a save game by storing all the necessary information in WebStorage though. A really simple way would be to store the current level, for example. Then you can restore them to the last level rather than having to save every single object's position, angle etc.

WebStorage stores the data in the browser on the user's computer. So as long as you're using the same browser and visiting the same web page, the values are remembered.
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Wed Jul 20, 2011 4:02 pm

Good thank you :)

I assume it works if we run a game in a browser on iPhone ?
B
6
S
2
G
1
Posts: 122
Reputation: 1,194

Post » Wed Jul 20, 2011 4:41 pm

Yep, I believe mobile browsers support WebStorage too. Haven't got a mobile to hand, maybe throw up a quick test to check?
Scirra Founder
B
359
S
214
G
72
Posts: 22,952
Reputation: 178,600

Post » Thu Jul 21, 2011 3:27 am

I have an iPod Touch 4, is ready to do a quick test
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,644

Post » Thu Jul 21, 2011 3:34 am

If someone deletes the cookies, can lose the saved game?
B
96
S
25
G
20
Posts: 3,055
Reputation: 22,644

Post » Thu Jul 21, 2011 7:17 am

It'll only clear if they clear the cache, not the cookies.
B
3
S
1
G
3
Posts: 49
Reputation: 1,148


Return to Construct 2 General

Who is online

Users browsing this forum: No registered users and 10 guests