Loading Array is breaking level unlock

0 favourites
  • 2 posts
From the Asset Store
Unlock Levels, Worlds & skin plus add coins by watching ads
  • Hello. I have an array that I use to hold each level and the number of stars earned. This is normal practice I understand. I also have a function which the system runs through to display the stars. It also displays the next level as unlocked if you have beaten the current level. This works perfectly. However, as soon as I added the Load JSON String LocalStorage.ItemValue on if my "arraysave" exists it now will not unlock the next level. As you can see in the screenshot I have the load of the array turned off. While it is like this everything works. As soon as I enable that, it will no longer unlock the next level. Curious enough, the current level does keep the stars and animations. Any help is appreciated.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • What happens is you mark the level as unlocked on start of the layout, and then the array data is loaded from LocalStorage and overwrites it.

    You need to move "Levels Set value at CurrentLevel to 1" into the LoadStars function.

    Also, you shouldn't load the array from LocalStorage every time players return to the menu screen. Ideally you load it only once, for example in Loader layout.

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