Dictionary and localstorage

  • Hi, i'm playing right now with Dictionary and Localstoage, i'm having two keys "Highscore" and "LevelName". I'm having problems when switching level because my "LevelName" get replace by the new one but keep Highscore from last one.

    Ex; Highscore : 30 secs - LevelName : Lvl1 when i'm moving level 2, Highscore still : 30 secs but LevelName : Lvl2.

    Is there any way that Dictionary figure it out when level name are differents they add a new key and set highscore associate with this new level?

    Thanks !

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You probably have an error in your code.

    For example - you set item in local storage, then immediately change layout where on start of the layout you are trying to read the same item. I've seen mistakes like this many times.

    Local Storage events are asynchronous, which means they require some time to read/write data. You should wait for "On Item set" and "On Item get" before making new Set or Get requests.

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