Unlock levels

Get help using Construct 2

Post » Wed May 29, 2013 1:14 pm

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 ....
B
25
S
4
G
2
Posts: 318
Reputation: 2,491

Post » Wed May 29, 2013 1:21 pm

post your capx please
B
41
S
17
G
8
Posts: 483
Reputation: 8,259

Post » Wed May 29, 2013 1:49 pm

Web storage does not work....
B
25
S
4
G
2
Posts: 318
Reputation: 2,491

Post » Wed May 29, 2013 2:03 pm

Here is picture:
B
25
S
4
G
2
Posts: 318
Reputation: 2,491

Post » Wed May 29, 2013 3:46 pm

Webstorage value are strings, you should compare each with :

int(WebStorage.LocalValue("save"))

instead of :
WebStorage.LocalValue("save")
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
51
S
22
G
18
Posts: 2,122
Reputation: 17,068

Post » Wed May 29, 2013 6:18 pm

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??????? Raiper3412013-05-29 18:19:22
B
25
S
4
G
2
Posts: 318
Reputation: 2,491

Post » Wed May 29, 2013 6:33 pm

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 rememberAphrodite2013-05-29 18:34:09
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
51
S
22
G
18
Posts: 2,122
Reputation: 17,068

Post » Wed May 29, 2013 6:36 pm

I tryed all ways... it newer worked....
B
25
S
4
G
2
Posts: 318
Reputation: 2,491

Post » Wed May 29, 2013 6:43 pm

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)
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
51
S
22
G
18
Posts: 2,122
Reputation: 17,068

Post » Wed May 29, 2013 6:54 pm

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....Raiper3412013-05-29 18:56:27
B
25
S
4
G
2
Posts: 318
Reputation: 2,491

Next

Return to How do I....?

Who is online

Users browsing this forum: R0J0hound and 3 guests