Continue to Next Level

Get help using Construct 2

Post » Sun Apr 13, 2014 11:07 am

Hello,

I am almost done with my game, just stumbled upon something i cannot figure out. My game is 72 levels, I would like to avoid having too many events for the "Next Level" button. I have named the layouts from 0-72, and I tried

On Button Clicked ----> Got to Layout "Layout.Name+1"

obviously it is not working, is there any way for this to happen?
Image Stoorn Memory Puzzle
B
9
S
3
G
1
Posts: 66
Reputation: 1,488

Post » Sun Apr 13, 2014 11:57 am

Code: Select all
str(int(LayoutName) + 1)
B
55
S
29
G
19
Posts: 1,520
Reputation: 25,630

Post » Sun Apr 13, 2014 1:58 pm

If your levels layout are called "Level_01" to "Level_75", to go to the next one, you could do:

Go to layout (by name): "Level_"& tokenat(LayoutName, 1, "Level_")
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
52
S
22
G
18
Posts: 2,122
Reputation: 17,093

Post » Sun Apr 13, 2014 3:35 pm

There are a few ways to go about it as mentioned above. This is the method I use:

I name my levels "Level1" to "Level71"
I create a global variable that determines which level I am at. Than when the player clicks on the next level button:
Add +1 to CurrentLevelVariable
Go to layout "Level"&CurrentLevelVariable

I also create another variable to store the highest level I've cleared. This is useful as you can create a continue button like many games that will bring the player to the level they have yet to clear. Hopefully this helps a bit.
B
42
S
20
G
31
Posts: 685
Reputation: 20,221

Post » Sun Apr 13, 2014 4:59 pm

Thank you very much, I actually used the 3 mentioned ways above for different parts of the game and now it is finally a complete level system ;) Every time I think i reached a convenient level in C2, I notice that there is more possibilities and much more to learn.
Image Stoorn Memory Puzzle
B
9
S
3
G
1
Posts: 66
Reputation: 1,488


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 5 guests