Going to the next layout

Get help using Construct 2

Post » Wed Apr 03, 2013 4:05 pm

So if you have a layout that occurs in between levels is it possible for it to go to different levels depending on what the layout before it was. For example if you have a "You Win" screen after you beat a level can you make it go to different levels depending on what level you beat? I wanna know so I can cut down on the amount of layouts.
B
18
S
5
G
4
Posts: 63
Reputation: 3,912

Post » Wed Apr 03, 2013 4:21 pm

Global variables. Look it up. That is all.
HARMLESS SIGNATURE THAT IS VIEWED BY OTHERS AS OFFENSIVE AND CONTROVERSIAL
B
14
S
3
G
3
Posts: 356
Reputation: 4,362

Post » Wed Apr 03, 2013 9:14 pm

I know it concerns global variables. What I want to know is how? I can check the whole manual but, it would help to know what to look for.
B
18
S
5
G
4
Posts: 63
Reputation: 3,912

Post » Wed Apr 03, 2013 11:54 pm

What, how to declare a variable or the logic you could use around one?

Just right click event sheet, add global variable.
It's then global to all event sheets, not just the one you create it on.

So with that in mind.. one way to make it work..

Curr level layout start - assign global variable to "Layout1"
On victory load "you win" layout
On "you win" layout, check the global variable (system>compare variable). If it is "layout1" then load "Layout2". If it is "Layout2" then load "Layout3" and so on.

If you are using numbered layouts as above, you can massively cut down on the events by storing level number, adding 1 to it, and concatenating your new name then use System>Load Layout by name.

e.g.

1, My layouts are called "MyLevelX" where X = level number
2, I load level 2. My global "LevelNo"is set to 2. I beat level 2.
3, In my "victory" layout I load the next layout by name simply as "Mylevel" & LevelNo+1 (which makes a string "MyLevel3" in this case).


silkc22013-04-03 23:57:49
B
20
S
6
G
2
Posts: 157
Reputation: 3,109

Post » Thu Apr 04, 2013 6:08 pm

Any joy?
B
20
S
6
G
2
Posts: 157
Reputation: 3,109

Post » Thu Apr 04, 2013 7:33 pm

Ah that makes sense. Thanks for the help!
B
18
S
5
G
4
Posts: 63
Reputation: 3,912


Return to How do I....?

Who is online

Users browsing this forum: 99Instances2Go, Colorfish, zenox98 and 24 guests