Unlock level

Get help using Construct 2

Post » Tue Jan 15, 2013 4:40 am

Hello everyone! I am creating my first game with construct 2 .... I have a small problem! since the game and the fact that I am creating levels, I would ar each level completed, in the game menu appears next Level unlocked ... I hope I explained ... thanks in advance
B
5
Posts: 18
Reputation: 840

Post » Tue Jan 15, 2013 8:30 am

I would suggest that you first make a global variable that remembers what is the highest level number unlocked so far. When the player reaches the end of level 1, do a condition check if the current level is the same as the highest level number unlocked, and if it is, increase that number by one, and return to the level selection layout.

On the level selection layout, exactly how you to this would depend on what visual style you prefer, but let's assume you want to show screenshots of all the levels in the game, and for those that you've unlocked you can click the screenshot to go to that level.

Create a sprite object called "LevelSelect" or something, and add the screenshots from the game to the different animation frames of that object. Add an instance variable to the object, called "level" or something, and make as many instances of this object as you have levels. Change the animation frames to give all the levels the correct screenshot, and in each of the sprites, set the level variable to a different level number.

In the level select screen's event sheet, you now need to add two things to make this work:

- Condition: LevelSelect > Compare instance variable > level less or equal to HighestLevelUnlocked
- Action: Go to layout (by name) > "Level " & LevelSelect.level

That makes all the links to levels clickable - the second step is to make all the locked levels LOOK unlocked. I think you can do that using For Each on the LevelSelect object: On start of layout, check if the level instance variable is greater than HighestLevelUnlocked, and if it is, make LevelSelect spawn another object: A big lock, a semi-transparent black square the same size as the screenshot, or whatever you want to use to make the screenshot look locked.

Or something like that. Haven't tested this, so it may not be bug-free.
B
8
Posts: 5
Reputation: 517

Post » Tue Jan 15, 2013 8:49 am

An obvious bug in my code ... When checking LevelSelect > Compare instance variable > level less or equal to HighestLevelUnlocked, you also have to add a second condition to check if that object is currently being clicked or touched. Sorry.
B
8
Posts: 5
Reputation: 517

Post » Tue Jan 15, 2013 9:05 am

@triks are you looking for something like this?

Webstorage multilevel saving
B
50
S
11
G
8
Posts: 479
Reputation: 9,911

Post » Tue Jan 15, 2013 10:14 am

B
31
S
9
G
1
Posts: 45
Reputation: 4,492

Post » Thu Jan 17, 2013 2:08 am

YES Wink ! webstorage ! ok!

thanks you !triks2013-01-17 02:09:06
B
5
Posts: 18
Reputation: 840


Return to How do I....?

Who is online

Users browsing this forum: austinblackbelt, Matthew de, Skebab, spcsmrf and 6 guests