How do I use the LocalStorage Plugin?

1 favourites
From the Asset Store
Unlock platyers earning coins, and save it with Localstorage
  • I made a little tutorial to explain the use of the LocalStorage plugin.

    https://www.scirra.com/tutorials/1461/h ... age-plugin

    Let me know if I missed something <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink">

  • Oleeeee!!!!

    Thankssss

  • Oleeeee!!!!

    Thankssss

    You're welcome

  • sorry but... where i can download the plugin?

    Also which is the difference between webstorage and localstorage?

  • The plugin is included in the latest version automatically. So just download the latest stable version of C2 and you have the plugin included.

    WebStorage has been deprecated at the ChromeStore. That's why scirra added the new LocalStorage plugin.

    Regards

  • Hello,

    I practice a little and i could create a program that when push a button add one to a text then i change to layer2 save to local and when i go back to layer 1 stay the same value, but... if i close the page and play it again starts from 0 why?

    screenshot:

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • First, if you not reset a layer, the globel variable stay alive.

    If I see right you never save to LocalStorage.

    Or I miss, everything is a little messed up.

    In first you save only the 0.

    In second you never get it, so you never can save.

    Clean up and try again.

  • Ok let me see if im correct.

    Layout 1

    1. check if the key exist.

    2. if exist get it and show it in the text.

    3. if not creat the key

    4. on click add one to text.

    5 on click go to layout 2

    Layout 2

    1. on start show the number on text2

    2. save the key to localstorage

    3. on click go to layout 1.

    is this correct or im missing something?

    Thanks death for the help.

  • we talk about two different layer, the eventsheets are seperat, true? (not includet)

    So how should the On item get condition in sheet 2 ever will triggert if the action is only in sheet 1?

  • Yes, layers are separated.

    Sorry i don't understand, so i need to add in layer 2 On item "key" exist - localstorage get item.

    Or in layer 2 i need to change get to set?

  • Yes, min. localstorage "get item", because if not, "on item get never" trigger.

    Or you do "set item" from any other condition, for example a button click.

    action and reaction, if there is no action there never will be a reaction. Law of nature.

    I think its better for you, you make an seperate sheet for this. and incude it to both other.

  • I will make you a sample, but will take some minutes.

    Settings

  • Hey AndreasR!

    First, thank you for sharing your knowledge.

    I'm pretty disapointed. I followed your tutorial closely and I would fail something, i guess. When I test my game, my text object return to initial value if I reload my layout. I tried to put a "coin counter system" in your example, and the same thing happend.

    What am I doing wrong? Could you post an example which can show us how to store value and add it to text object on layout loading?

    Thank you for reading!

  • Hey AndreasR!

    First, thank you for sharing your knowledge.

    I'm pretty disapointed. I followed your tutorial closely and I would fail something, i guess. When I test my game, my text object return to initial value if I reload my layout. I tried to put a "coin counter system" in your example, and the same thing happend.

    What am I doing wrong? Could you post an example which can show us how to store value and add it to text object on layout loading?

    Thank you for reading!

    I'll update the sample file when I'm home

  • Hey AndreasR!

    First, thank you for sharing your knowledge.

    I'm pretty disapointed. I followed your tutorial closely and I would fail something, i guess. When I test my game, my text object return to initial value if I reload my layout. I tried to put a "coin counter system" in your example, and the same thing happend.

    What am I doing wrong? Could you post an example which can show us how to store value and add it to text object on layout loading?

    Thank you for reading!

    Sorry I couldn't attach the file to this post or to my tutorial.

    You can download it here: https://shatter-box.com/?p=11326

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