How do I Use Local Storage to Save Game Levels

Get help using Construct 2

Post » Sat Jul 23, 2016 3:36 pm

Message: Picsels can only post plain text URLS until they have 500 rep. 1 URLS modified. Why?
Hello everyone,

I am designing a game with multiple levels, each level on a certain layout. What I want is if a user passed a certain number of levels (e.x passed level 3), I want to load the next level for him when he reopen the game (in our case level 4).

I tried using localStorage and this is a snapshot of my event sheet:

http://d.top4top.net/p_204o9dm1.png

(to be clear we are now on a home layout (layout 2) which is nothing there just click on the mouse to start playing.)

what I am doing in this event sheet is I check if the key (levelReched) is not in the storage, if it is not there add it and assign "1" to it.
in the next event if (levelReached) is there, get it.
Now if the mouse clicked and (levelReached) value = "1" , got to first level (layout 3).
and the same for the other levels.

But the problem is that when I click the mouse nothing happens!! it does not go to any layout, it is still on home layout (layout 2).


I really appreciate any help from you guys.
B
3
Posts: 3
Reputation: 181

Post » Mon Jul 25, 2016 12:03 am

Haven't used LocalStorage in a bit so maybe I'm not remembering correctly, but, I think you need LocalStorage to run a "check if item exists" (you can stick that into the On Start of Layout event) before it'll respond to "is item missing".
B
52
S
24
G
18
Posts: 295
Reputation: 13,090

Post » Mon Jul 25, 2016 11:20 am

Sup with that? wrote:Haven't used LocalStorage in a bit so maybe I'm not remembering correctly, but, I think you need LocalStorage to run a "check if item exists" (you can stick that into the On Start of Layout event) before it'll respond to "is item missing".


I did exactly what you are suggesting, but still not working
B
3
Posts: 3
Reputation: 181

Post » Mon Jul 25, 2016 6:35 pm

Hmm, well looks like the last project in which I used a storage it was a WebStorage instead of Local. Guess I got nothing, maybe see if this tutorial on LocalStorage can help solve the problem. It's got examples you can try.
B
52
S
24
G
18
Posts: 295
Reputation: 13,090

Post » Fri Jul 29, 2016 11:55 am

Sup with that? wrote:Hmm, well looks like the last project in which I used a storage it was a WebStorage instead of Local. Guess I got nothing, maybe see if this tutorial on LocalStorage can help solve the problem. It's got examples you can try.


Thank u so much, I already red this tutorial before, it didn't help either but I managed to get what I wanted exactly with system save & load.
B
3
Posts: 3
Reputation: 181


Return to How do I....?

Who is online

Users browsing this forum: MassimoF and 22 guests