0 Favourites

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

  • 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? <img src="{SMILIES_PATH}/icon_cry.gif" alt=":cry:" title="Crying or Very Sad">

    I need help. Thanks.

  • 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? <img src="{SMILIES_PATH}/icon_cry.gif" alt=":cry:" title="Crying or Very Sad">

    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 <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

  • > 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? <img src="{SMILIES_PATH}/icon_cry.gif" alt=":cry:" title="Crying or Very Sad">

    > 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 <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    Wow thanks! I was having trouble understanding it, but you cleared it up! Will this work using an array for level select/unlocking levels?

  • 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.

  • Construct 3

    Buy Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Buy Now Construct 3 users don't see these ads
  • 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!

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)
Similar Topics Posts Views Last Post
Unread hot topic
167 14,485
DMT2005's avatar
DMT2005
Unread sticky
1 Favourites
C2 Games made with CocoonIO
136 89,811
minhcuong's avatar
minhcuong
Unread hot topic
99 10,130
karshinkoff's avatar
karshinkoff