How to Create Save and Load in CocoonJS ?

  • How to Create Save and Load in CocoonJS ? (CocoonJS Doesn't support WebStorage plugin's !)

    Thanks

  • Bump, since I was wondering the same (and still am!) ;)

  • CocoonJS still supports Local Storage, but doesn't session.

  • Somehow, I got cocconJS to work with webstorage. I saved some data, closed the app, came back to the app, and it worked fine.

    Edit: I just read the CocoonJS tutorial, to check on the limitations.

    Joannesalfa is correct, You can easily overcome this by using global variables. Local storage is (some what) permanent save, where as session is for that session only (much like the incognito mode in most browsers).

  • CocoonJS still supports Local Storage, but doesn't session.

    That was what I was thinking too but when I launched my game on ios using webstorage for saving high score data between games, I got the black screen. I removed webstorage and the game runs properly...   <img src="smileys/smiley19.gif" border="0" align="middle" />

  • Global variables don't persist between sessions - you shouldn't rely on them because even if you close and reopen and they're still there, there's a chance the OS could kill the app which will reset all the variables. Also the phone restarting will wipe global variables again.

    Just use WebStorage - writing to local storage will save data permanently.

  • Ok, now webstorage works fine! I wonder what was wrong earlier... <img src="smileys/smiley24.gif" border="0" align="middle" />

  • Ashley

    I meant to over come session limitations. Just wanted to clear it up so I don't look silly in front of the great C2 developer ;D

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Ashley ludei

    I love the new Load/Save system that you guys introduced recently. It does exactly what I need. I notice that it doesn't work with CocoonJS unfortunately. Are there any plans to get this working? This would be amazing! I am working on a game for Ouya / Android Phones, and a save system is very important. With this and some support for Ouya controllers (from Ludei) and I will be set! :) Thanks for any info!

  • WebStorage doesn't safely.

    Your game data may be cleared five days later, may be ten days...

    And it is depressing me.

  • There's a bug that prevented save/load from working in CocoonJS. It should be fixed in the next build.

    WebStorage is not a cache, so clearing the browser cache does not clear WebStorage.

  • That is great news. Thank you, Ashley.

  • Ashley

    I tried the latest build of Construct2, and exported to CocoonJS, but the Save / Load issue is not acting the same as on PC. It appears as if it is trying to work, but all it does is restart the current layout when 'load' is used. :/

    It is definitely acting different from how it did last build. I have text on the screen that I print to show what state it is in (like in your tutorial). Before, it would state that there was 'NO SAVE GAME' when I would load, but now it says 'LOADED', which tells me that it thinks that it has loaded the save, even though it really has not.

    Any ideas?

  • Zharzew - I tested it and verified it worked on CocoonJS. Post a .capx demonstrating your issue if you still have trouble.

  • Ashley Yeah, I just checked my script, and found an error on my part. It is working the same as on PC. Thank you for your help. :)

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