How do I check if a layout (by name) exists?

0 favourites
  • 7 posts
  • The title basically says it all: Is there a way to check if a layout (by name) exists?

  • There's no way to check this. Probably because there's no way to create a Layout dynamically so you would always know which layouts exist and which doesn't.

    What exactly are you trying to do? Why would you need such an action?

    Cheers!

  • Thanks for that. Then I will have to implement a little workaround.

    What I am trying to do is: Lets say I have 10 chapters with 10 levels each. Every level has its own layout. The names of the layouts are "LevelXY" with X - chapter and Y - level (inside the chapter). On my generic "LevelSelect" layout are 10 buttons. If I am in chapter 3 and press button 4 it starts:

    "Level"&Chapter&Level

    But... some levels have special "Intro"-layouts prior to the level. They are named like "Level01_Intro". But only some. I wanted to do:

    if (Intro exists) { StartIntro() } else { StartLevel() }

  • Hey brunopalermo! Haven't seen you here for quite a while, welcome back!

    Gumbo You can try to switch to intro layout, then after "Wait 0" check if layout has actually changed (using layoutName expression). If not, this means that there is no intro layout for this level.

    Or simply create a list of all intro layouts in a text variable and check it:

    Variable IntroLayouts="0101;0102;0201;0205;0401;"
    if find(IntroLayout, "0201;")>=0 then go to intro layout
    Else go to level layout
    
  • Thank you for the answer. Yes I will do something like your second suggestion. Since I already have a "LevelMatrix"-Array that stores some values for the single levels I will just add another dimension which says if there is an intro or not.

  • it possible using the "script" feature.

    here example

    oyunkulturu.com/temp/capx/layout_check.c3p

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Hey dop2000! Been away for a while. Too much work. lol.

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