0 Favourites

Save and load current level in this capx?

  • Hi everyone,

    I have been looking at this capx:

    https://dl.dropbox.com/u/8367729/constr ... lect6.capx

    Which works fine, except it wont save and load the current level (text) & currentLevel global variable..

    It remembers the open level images, but the current level text ramains as "current level=1" when you refresh the browser.

    Does anyone know how to keep the current level?

    I really, really need your help guys!

    Here is an example:

    [attachment=0:1belvq6u]2222.png[/attachment:1belvq6u]

  • Construct 3

    Buy Construct 3

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

    Buy Now Construct 3 users don't see these ads
  • You just need to save the variable to webstorage when it changes and then load it again on start of layout.

    But the currentLevel variable in that capx is just used to track the level you're currently playing so that it knows which values to update when you complete the level. It gets set when you click on a level button to start a level. There's no need to save/load it really.

  • Hi ramones, thanks so much for the answer!

    Thats really nice of you :0)

    I tried that as the first thing, but i get an "key does not exist"

    Is there a chance that you could provide an example? maybe just update the capx in this thread and post it?

    Im really puzzled about this. It would be extremely helpful!

    i was sitting and waiting for someone to repond, so thanks again!

  • Load from WebStorage (on start of layout):

    [attachment=0:2bfo3o0x][/attachment:2bfo3o0x]

    Save to WebStorage (whenever currentLevel is changed):

    [attachment=1:2bfo3o0x][/attachment:2bfo3o0x]

    Why do you want to store that variable?

  • Ramones, your awesome! Thanks man..

    Could it be that i was missing the "int"?

    I need to store the value because im making an interactive level select map (like candy crush on facebook)

    Where the player moves along the map, from the last played lvl.. Its a bit complicated, but thanks to you it now works! so thanks again!

  • xanxion Is your level select map displays your facebook friends progress? (Like Candy Crush does with your friends pictures). I did not find a way of doing that will all the facebook plugins I saw on scirra.

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