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">

  • Try Construct 3

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

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

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