Unlock levels

0 favourites
  • 12 posts
From the Asset Store
Unlock Levels, Worlds & skin plus add coins by watching ads
  • Hi,

    i have one problem with save and i do not understand why....

    I have layout with levels (one picture symbolise one level) and at start level 2 3 and 4... are locked, but when i complete level 1 i need to unlock level2....

    I have this in layout with levels

    if global number save = 4 then destroy sprite lock 1, sprite lock 2 ....

    in levels i have (for example for level 2)

    start of layout -> set global number level to 2

    sub event: if level > save then set save to level and set local key save to global numer save.

    in layout logo (first layout) i have

    start of layout -> set global number save to WebStorage.LocalValue("Save")

    and

    if local key save does not exist -> set global number save to 1

    but it does not work... levels are stil locked ( i do not turn off game)

    please help me ....

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • post your capx please

  • Web storage does not work....

  • Here is picture:

    <img src="https://dl.dropboxusercontent.com/u/21297365/obrazky/problem.png" border="0" />

  • Webstorage value are strings, you should compare each with :

    int(WebStorage.LocalValue("save"))

    instead of :

    WebStorage.LocalValue("save")

  • NO effect, always only last plaed level is unlocked. For example i play and complete 4 levels (all 4 levels are unlocked) but then when i play again for example level2, only level 1 and 2 are unlocked.... i am confused.... i really do not know why???????

  • Maybe the fact you changed the value of "save" in level 10 and compare for "Save" is a problem, this is case sensitive If I remember

  • I tryed all ways... it newer worked....

  • did you tried to change one of the condition to make locks disseapear into something always true? just to check

    (also, if you use chrome, by doing F12, you can see the webstorage content, and so see directly the value and set it)

  • yes I did it is not about bug in level choose layout.... but in levels...

    it always change web storage save to last played levels global number ....

    this condition (if level > web storage save) then does not work....

  • so, the vaue of the webstorage is changing in levels, so the condition is always true, hum

    maybe if you set the key to

    max(level, int(WebStorage.LocalValue("save")))

    this expression chooses the biggest value

  • Thx for help Aphrodite, godnes of Love :)

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