How do I put local storage on my game select level

  • Hello guys,

    I been trying to put local storage on my game but i failed, every time I clear the stage and refresh browser it wont load from local storage.

    anyone can fix my capx file is much appreciate.

    https://www.dropbox.com/s/qhimrwy5tv95v ... .capx?dl=0

    Thank you

  • mec

    well, there were quite a few problems in there. It was actually saving the data, but it was never reading it and even if it did, the defaults were getting reset after every level. There was a lot happening every tick that didn't need to be running. I found the code very difficult to follow, so I structured it in a way that makes sense to me!

    It works well now... I put in comments to try to explain what I was doing. I didn't add any error checking (because there isn't much you can do) but it does adapt itself if the number or levels increases - you will need that because it did save on your system thinking there were 4 levels and now it thinks there are 12.

    http://www.rieperts.com/games/forum/localsavefix.capx

  • mec

    well, there were quite a few problems in there. It was actually saving the data, but it was never reading it and even if it did, the defaults were getting reset after every level. There was a lot happening every tick that didn't need to be running. I found the code very difficult to follow, so I structured it in a way that makes sense to me!

    It works well now... I put in comments to try to explain what I was doing. I didn't add any error checking (because there isn't much you can do) but it does adapt itself if the number or levels increases - you will need that because it did save on your system thinking there were 4 levels and now it thinks there are 12.

    http://www.rieperts.com/games/forum/localsavefix.capx

    Thank a lot AllanR.

    Now, I understand more on local storage

    Much appreciate

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Need help with my own Stage Select; Maybe this can help me...

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)