How do I unlock levels through loops

Just started using Construct 2? Post your questions here

Post » Wed Jun 25, 2014 4:10 pm

How do I unlock levels by using WebStorage and For loop?
I'm using the map system for level selection.

My events:

System: Start of layout
--System: For "unlock" from 2 to 10
--System: WebStorage.LocalValue(str(loopindex)) = 1
--LevelPoint: ID = loopindex
----LevelPoint: Set locked to false


My events doesn't work :(

Do I have to use something else instead of loops?
Twitter | Facebook | Instagram

If you play Puyo Puyo games, you can meet me at the Puyo Puyo English Community Discord: https://discord.gg/0k41S8ARwvY2iTIQ
B
104
S
24
G
11
Posts: 698
Reputation: 12,935

Post » Fri Jun 27, 2014 3:37 am

Why don't you use an array? Set 0 for locked, 1 for unlocked and 2 for completed ones. Then you just compare values on the array.
B
34
S
5
G
1
Posts: 164
Reputation: 2,725

Post » Fri Jun 27, 2014 4:04 am

Get rid of the"unlock" tag OR use loopindex("unlock").
ImageImageImage
B
71
S
22
G
259
Posts: 3,794
Reputation: 143,704

Post » Fri Jun 27, 2014 4:12 am

@blackhornet correct me if I'm wrong but I think it will work ok like that. It should access the index of the currently running loop.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Fri Jun 27, 2014 4:17 am

I've changed my mind, I'm actually want to lock the levels until the previous level is completed. But I think I want to enable the player to play any levels available in the game.
Twitter | Facebook | Instagram

If you play Puyo Puyo games, you can meet me at the Puyo Puyo English Community Discord: https://discord.gg/0k41S8ARwvY2iTIQ
B
104
S
24
G
11
Posts: 698
Reputation: 12,935

Post » Fri Jun 27, 2014 1:30 pm

@codah You are correct. It does still work.
ImageImageImage
B
71
S
22
G
259
Posts: 3,794
Reputation: 143,704


Return to Beginner's Questions

Who is online

Users browsing this forum: No registered users and 4 guests