How to use WebStorage?

Get help using Construct 2

Post » Fri Nov 11, 2011 10:24 am

Hello! Who can set an example as to use WebStorage, for saving levels? Or can eat other method as it to make?
B
18
S
2
G
2
Posts: 21
Reputation: 2,413

Post » Fri Nov 11, 2011 3:47 pm

It's difficult to save an entire level to WebStorage - I'd suggest just saving the level number they're reached, or stage, checkpoint, etc.
Scirra Founder
B
357
S
214
G
72
Posts: 22,946
Reputation: 178,228

Post » Tue Jul 31, 2012 6:32 am

@Ashley, It's only difficult or it's impossible? I mean it because I'll probably make a game that need to save entire levels, like if you play minecraft and save your game, exactly.
B
17
S
4
G
4
Posts: 104
Reputation: 3,950

Post » Tue Jul 31, 2012 9:07 am

I'd say he meant difficult. You have to explicitly specify all the info you want to save.

Here is one idea:
http://dl.dropbox.com/u/5426011/examples13/save_load.capx

I use the dictionary object to store the named values for each object. I then insert dictionary.AsJSON into the array for each object. The array now is a snapshot of what I want to save. It is then trivial to save to webstorage with the action:
webstorage: set local key "game_save" to Array.AsJSON
B
79
S
24
G
52
Posts: 4,724
Reputation: 39,711


Return to How do I....?

Who is online

Users browsing this forum: badmoodtaylor and 13 guests