How do I - Webstorage Arrays Multiple Levels

0 favourites
  • 9 posts
From the Asset Store
Unlock Levels, Worlds & skin plus add coins by watching ads
  • Im really stuck here.

    I have been following some tutorials trying to get my arrays into webstorage but it is only half working.

    What happens is... The webstorage is saving only some of my data. (Im not positive its saving data still or if its loading an old key, but that green checkmark makes me think it still is.)

    In the two pictures below it saves the fact that i completed level one yet wont unlock level two even when the current level variable shows that it should be going up.

    For some reason there is no change.

    And this is how i have my webstorage and array events set up (as the tutorial said, so i must be missing a step.)

    The top picture is on the game events page

    The bottom picture is on my level select page

    Whats strange is that it saves my progress and shows what levels i completed and how many stars i achieved when reloading the browser, but it wont let me progress.

    Im sure i explained this really horribly. Maybe someone could help me start fresh with saving my array to webstorage. None of the tutorials cover multiple levels. Maybe send me a pm and i can show you my capx. So stuck right now :/

  • Oh and heres the rest of the events that cover the level select.

  • Line52:

    Set value at currentlevel to max(2+star, int(levels.at(currentlevel)))

    When you store in webstorage values will be converted into string, so you have to convert them back to number using int() to load it into number variables.

  • Hmm i tried changing that and i can now move on to the next level but its still not doing the whole webstorage part.

    Just to clarify was this what you meant?

  • Yes, and not just that, basically everything that uses your levels array.

  • Hmm :/

    Still trying to figure this out i showed you everything that references the arrays in the pictures. Do you have any other suggestions? Or would you look at my capx?

    How would i go about adding Int() to the other parts that reference the arrays?

    Im still a little confused.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You have to unlock the next level in the array when you complete a level. After you 'Add 1 to currentLevel', you should set the array value at currentLevel to 1.

  • Crawnic

    Did you find the answer?

    I have same problem here!

  • I actually did not find the answer. I did get it fixed though.

    Unfortunately i had to use a working capx as a base file and pretty much work off of that by transferring my files into the capx.

    https://www.scirra.com/tutorials/1160/p ... l-selector

    Thank you for the capx DuckfaceNinja !

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