How do I use webstorage to make a last level reached save?

Get help using Construct 2

Post » Mon Jul 14, 2014 5:39 pm

I need to use webstorage for a very simple "Last level reached" save. After completing a level, the game will go back to the level select screen with the new level unlocked, kind of like in the super mario games. Ashley referenced it being possible in this tutorial: https://www.scirra.com/tutorials/526/ho ... -savegames

I cant really find any tutorial or anything on this and Im having a real hard time understanding it. My head feels like exploding trying to make sense of it and Im staring to get frustrated, can anyone please help or something? :cry:
I need help. Thanks.
B
12
S
2
Posts: 57
Reputation: 799

Post » Mon Jul 14, 2014 7:44 pm

p0tayters wrote:I need to use webstorage for a very simple "Last level reached" save. After completing a level, the game will go back to the level select screen with the new level unlocked, kind of like in the super mario games. Ashley referenced it being possible in this tutorial: https://www.scirra.com/tutorials/526/ho ... -savegames

I cant really find any tutorial or anything on this and Im having a real hard time understanding it. My head feels like exploding trying to make sense of it and Im staring to get frustrated, can anyone please help or something? :cry:
I need help. Thanks.

You don't really need any tutorial for this. Let's see..
Create a variable (something like 'savegame') and give it a 0. So, no saves yet.
You just need to add 1 to this variable any time that a level begins.
And in the same event, use the webstorage "set local value".
Create whatever key and set the 'savegame' variable to the 'value'.

Now you have the data that you want.
If you have any questions, let me know :)
B
20
S
4
Posts: 387
Reputation: 2,274

Post » Mon Jul 14, 2014 8:15 pm

Zathan wrote:
p0tayters wrote:I need to use webstorage for a very simple "Last level reached" save. After completing a level, the game will go back to the level select screen with the new level unlocked, kind of like in the super mario games. Ashley referenced it being possible in this tutorial: https://www.scirra.com/tutorials/526/ho ... -savegames

I cant really find any tutorial or anything on this and Im having a real hard time understanding it. My head feels like exploding trying to make sense of it and Im staring to get frustrated, can anyone please help or something? :cry:
I need help. Thanks.

You don't really need any tutorial for this. Let's see..
Create a variable (something like 'savegame') and give it a 0. So, no saves yet.
You just need to add 1 to this variable any time that a level begins.
And in the same event, use the webstorage "set local value".
Create whatever key and set the 'savegame' variable to the 'value'.

Now you have the data that you want.
If you have any questions, let me know :)


Wow thanks! I was having trouble understanding it, but you cleared it up! Will this work using an array for level select/unlocking levels?
B
12
S
2
Posts: 57
Reputation: 799

Post » Tue Jul 15, 2014 4:42 am

@p0tayters
Yup, it works.. but I'm not that familiar with arrays.
I think with it you don't need variables... just the array data.
B
20
S
4
Posts: 387
Reputation: 2,274

Post » Tue Jul 15, 2014 3:15 pm

Zathan wrote:@p0tayters
Yup, it works.. but I'm not that familiar with arrays.
I think with it you don't need variables... just the array data.


Awesome thanks this is just what I needed!
B
12
S
2
Posts: 57
Reputation: 799


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 53 guests