Switching to a new layout and setting variables

0 favourites
  • 6 posts
From the Asset Store
Easily store, modify, read and manipulate colors with Color Variables!
  • 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!

    • Tom
  • 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.

  • Thanks for your answer. Unfortunately, it doesn't resolve the issue. Does anyone else has a clue on how to do so? Thanks!

  • 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


    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)

  • Hi,

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

    Thanks a lot for the enlightenment!

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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).

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)