How do I use the LocalStorage Plugin?

1 favourites
From the Asset Store
Unlock platyers earning coins, and save it with Localstorage
  • Great!

    And as a bonus, I learn to use function object!

    It would work to very well for katzin's tests, because it works for multi layout project...

    Thank you very much AndreasR !

  • Thanks a lot Death and Andreas for your support

  • norab katzin

    You're welcome, I'm glad to help

  • I'm trying to use this to make a high score system, here's what i have so far.

    On start of layout: Check item "HighScore_Key" exists

    On item "HighScore_Key" exists: Get item "HighScore_Key"

    On item "HighScore_Key" get: Set HighScore to LocalValue.ItemValue

    On item "HighScore_Key" missing: Set item "HighScore_Key" to TotalDistance (which is the current score value)

    Every tick: highscoretext: Set text to HighScore (which is the global variable)

    It starts out like usual but then when the game ends, the number goes right back to 0. Do you know how to fix this?

    Thanks for any help!

  • I'm trying to use this to make a high score system, here's what i have so far.

    On start of layout: Check item "HighScore_Key" exists

    On item "HighScore_Key" exists: Get item "HighScore_Key"

    On item "HighScore_Key" get: Set HighScore to LocalValue.ItemValue

    On item "HighScore_Key" missing: Set item "HighScore_Key" to TotalDistance (which is the current score value)

    Every tick: highscoretext: Set text to HighScore (which is the global variable)

    It starts out like usual but then when the game ends, the number goes right back to 0. Do you know how to fix this?

    Thanks for any help!

    Can you attach a capx example?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • thank you so much AndreasR, it's work!

  • thank you so much AndreasR, it's work!

    Awesome news

  • https://www.dropbox.com/s/xts5c0skst2f5 ... aproj?dl=0

    I am actually using the Local Storage, but i just called it WebStorage. I forgot to add a reset button so if you do, i'm pretty sure it takes the high score back to 0 too.

  • dropbox.com/s/xts5c0skst2f5r6/New%20project.caproj

    I am actually using the Local Storage, but i just called it WebStorage. I forgot to add a reset button so if you do, i'm pretty sure it takes the high score back to 0 too.

    Please save as 'Single File' instead of saving as a project. I can't open the uploaded file. It must end with .capx

  • Oh, sorry. Here's the single file. https://www.dropbox.com/s/296as2rrrem6z ... .capx?dl=0

  • Oh, sorry. Here's the single file. https://www.dropbox.com/s/296as2rrrem6z ... .capx?dl=0

    Thanks <img src="{SMILIES_PATH}/icon_e_wink.gif" alt=";)" title="Wink">

    You find the fixed version here.

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

    I altered the way how to update the current score.

    You just forget to 'Set Item '...' to HighScore' to save it. Now it works.

  • Thank you!

  • Okay, so i tested it and it worked fine. I got the score to 8,000 just to make sure it works. Then i copied the events into my game, and i tested it, the high score was going up fine as i played, but when the game was over, the high score went to 8,000. I went back to the one you made and i changed the score to 50. Then i tested my game again and the high score went to 50 when the game ended. So the high score was saving the project you made even though it was a whole another project. I even deleted the project and it still did the same thing. Do you know how to fix this? Sorry, i'm still a beginner. Thanks!

  • Okay, so i tested it and it worked fine. I got the score to 8,000 just to make sure it works. Then i copied the events into my game, and i tested it, the high score was going up fine as i played, but when the game was over, the high score went to 8,000. I went back to the one you made and i changed the score to 50. Then i tested my game again and the high score went to 50 when the game ended. So the high score was saving the project you made even though it was a whole another project. I even deleted the project and it still did the same thing. Do you know how to fix this? Sorry, i'm still a beginner. Thanks!

    It's hard to say what the problem of your code is, whithout seeing your code.

    I only can check it if you drop me a mail with your project file.

    contactlvs@shatter-box.com

    Regards

    Andreas

  • I just got it to work right, i changed the key and variable names and then it worked. Thanks for the help!

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