Switching to a new layout and setting variables

Get help using Construct 2

Post » Wed Dec 07, 2011 12:09 am

Hi!

In the game I'm currently making there's many level and I'd like to add a layout between level showing stats and which level is next.

The problem is that I don't want to create multiple layout for each levels. I'd like to re-use the same one so that is why I'd like to:

At the end of a level, switch to my "between" layout and set its global variable LevelNumber to where it's going to go next and make a button to start the next level.

So the second question is : Is it possible to dynamically load a layout? Like Set layout to "Level_ + LevelNumber" ?

Thanks a lot!

- Tomtomshreds2011-12-14 01:09:50
B
6
G
2
Posts: 43
Reputation: 1,211

Post » Wed Dec 07, 2011 1:19 am

It appears that that isn't a Go To Layout that accepts a level name or level number. So you're out of luck :( The expression is System.Go To Layout but it doesn't accept and expression like name or number. I'm a bit sleepy so i could be wrong :D

To improve this all i suggest the ability to set the layout flux at edit time like MMF2. So that would exist an screen on which you would arrange layout loading order. So you could do System Go to Next Layout or System Go to Previous Layout. And add an expression Next Layout Name and Previous Layout Name or something like that. A simple Go To Layout is insufficient.Kiyoshi2011-12-07 01:23:25
B
58
S
13
G
10
Posts: 632
Reputation: 12,505

Post » Wed Dec 14, 2011 1:09 am

Thanks for your answer. Unfortunately, it doesn't resolve the issue. Does anyone else has a clue on how to do so? Thanks!
B
6
G
2
Posts: 43
Reputation: 1,211

Post » Wed Dec 14, 2011 1:14 am

Use your global var "Level".

In startup of layout1, this var allows you to initialise the level 1.
When in the "between" layout, add 1 to level (since it leads to the next level), and test the value of "Level".
If level is 1 => go to layout1
if level is 2 => go to layout2
Etc...

Since the use of expressions isn't yet available for this (but on ashley's todo list already) this is the workaround.

There are other few examples in the how to do list in the section layout as well as the current trick to duplicate layouts (which is, I think, one of your next question if you haven't resolved it yet :D)Kyatric2011-12-14 01:15:21
New to Construct ? Where to start

Image Image
Image Image

Please attach a capx to any help request or bug report !
Moderator
B
247
S
85
G
40
Posts: 6,998
Reputation: 57,791

Post » Wed Dec 14, 2011 1:23 am

Hi,

I should had thought about this!!! This is very simple to resolve hahaha!

Thanks a lot for the enlightenment!

B
6
G
2
Posts: 43
Reputation: 1,211

Post » Sun Nov 25, 2012 11:28 pm

thxxxxxxxx to Kyatic!
It's a good way to make many levels with the same event sheet in the free edition (limited to 100 events).kayupla2012-11-25 23:35:59
B
8
S
2
G
1
Posts: 34
Reputation: 1,564


Return to How do I....?

Who is online

Users browsing this forum: LaroTaio and 2 guests