Local Storage question

0 favourites
  • 13 posts
From the Asset Store
Basic Plugins for Firebase Authentication, Realtime-Database, Firestore, Cloud Storage
  • Hi.

    I have a hard time saving a variable with the local storage plugin.

    I need to save the level progress in my game. I've included those events in the image in every level but not in the MainMenu event sheet. How should I separate those lines so they work properly?

    I am using NW.js

  • And what's the problem?

  • The problem is that it doesn't work properly.

    When I disable the group with the LocalStorage plugin, it work fine but it does not save the variable (obviously).

    When I enable it, when I'm in the MainMenu, Levels = 1, as it should. When I enter the first level, Levels = NaN. And if I go back in the MainMenu all levels are visible, when it shouldn't be like that.

  • Try setting levels to int(localstorage.itemvalue), maybe the stored number is now a str. For the levels being visible I don't see any events or logic relating to that.

  • I've tried that but I get the same result.

    The levels should be all visible in the MainMenu if Levels=18, when after finishing the first level it should be 2.

  • There's too much unknown information. You also shouldn't need to get the item from local storage at the start of each layout, only on first load of the game. I can't see any events for the main menu. Better to share the project to debug the error.

  • You should save to LocalStorage before you call the function quit game.

    And try to log the value of LocalStorage to see it.

  • Maverick1912 Which line of those saves the local storage?

    I made this save system after a tutorial I found on youtube.

    I tried to create an example of what I have in my big project.

    Curious is that in my example I don't get that value (Levels = NaN) at start of the level, anyhow it seems to work ...

    Could any of you look over this example and tell me or modify it the right way?

    And how to set ClearStorage properly so I can test it easily?

    I finished my original game project and I want to upload it on steampowered.com. I just have to get done a few things like the LocalStorage - that should save the level progress.

    dropbox.com/s/dlzlro4jyk9k7hn/LocalStorageTest.capx

  • There you go:

  • Ok, but isn't the same thing?

    I mean, after collision, "system" events will trigger and 2 seconds later will quit the level?

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • There's no point sharing a tutorial that works, asking us to look for errors. You would need to share the project that has the problems.

  • I think that tutorial doesn't work the same for me because it has to be adapted for my project. If you could take a look would be awesome.

  • Maverick1912 I'm interested in the pie chart project. Reach me at my gmail at jogosgratispro

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