(changed) Webstorage issue in preview.

0 favourites
  • 9 posts
From the Asset Store
Simplistic hyper-casual game with nature elements. Tap to switch between the 4 elements and reach a better score.
  • Hi again,

    I was wondering if there is a way for a player to delete save states from a game. Lets say for example, you have three save game files using the "Save" and "Load" functions: e.g. mysave1, mysave2, mysave3.

    However, the player wants to restart from scratch and wants to delete a file, I don't see anything in the System settings to make this work, or am I missing something? I'm trying to implement a save system and it donned on me that I can't find a way to allow the player to delete save states.

    Thanks!

  • Right now my idea for a work-around is to make a save function similar to that from Sonic 3&K where you can always start a new game, but you can overwrite save files if you so please.

  • Actually, scratch deleting save states. I did find a work around where the player can create a new game, which erases arrays and other instances and variables to emulate starting over. The three save slots I've made will use the Save/Load states.

    However, I'm looking at a couple tutorials on saving arrays:

    saving-and-loading-an-array-to-webstorage-capx_t68859?start=20

    https://www.scirra.com/tutorials/307/ar ... ers/page-3

    Here's the example, I thought I was following the directions to the letter, but when I restart the preview on Node Webkit it acts like nothing is there. Is it just a preview thing and I need to export it to truly test it out? The capx is 200mb and I couldn't upload an attachment so all I have is this screenshot. Hope that explains it.

  • Remove the quotes from "SaveArray.AsJSON" so it's just SaveArray.AsJSON should do it (otherwise the only thing saved is the literal text: "SaveArray.AsJSON"

    Hope that helps

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Remove the quotes from "SaveArray.AsJSON" so it's just SaveArray.AsJSON should do it (otherwise the only thing saved is the literal text: "SaveArray.AsJSON"

    Hope that helps

    Ah, I wasn't supposed to put that part in quotations then? Thank you so much, this frustrated me for the most part of yesterday! I think it works now, I might even go back and replace save states with webstorage. Yes, even in the previews the webstorage held up.

    Thanks mate!

  • Nope, usually for variables/expressions there should never be quotes I think, and awesome glad to hear it's working!

  • Well, thanks Jayjay! With webstorage I've made a fully functional multiple save game menu. It was mainly for all the arrays I've used for level completion, gold coin gathering, and power upgrades.

    Unfortunately the tokens you collect to buy the upgrades will disappear when you restart your save file since they are global variables. Originally I was using save states, but the save states can mess up other saves which was another part of my frustration. I may have to revamp the game somehow, but I feel better that this issue was resolved.

  • You can try storing the global variables into the array on save and then when loading set them from array

  • You can try storing the global variables into the array on save and then when loading set them from array <img src="{SMILIES_PATH}/icon_e_smile.gif" alt=":)" title="Smile">

    I didn't know you could do that, but I also found another method that also worked, I used a tutorial from here:

    https://www.scirra.com/tutorials/968/ho ... webstorage

    I don't know if that's what you're referring to, but It took some figuring out since I'm still a touch programming illiterate when it comes to this stuff, but after a few placements I finally managed to figure it out and now the global variable for my game's tokens are saveable! (As long as the user doesn't oversave the wrong file, haha.)

    Thanks for your help mate.

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