If layout exists

0 favourites
From the Asset Store
Plugin Transition Layout C3. Layout opening and closing animation for C3. Quickly set up transitions between lay
  • Is there a way to check if a layout with a given name exists?

  • Yes, go to the projects bar on your right, and look in the layouts folder. If this makes no sense, go to the VIEW tab on the top of construct2 and check off "Project Bar"

  • I think he means via events. I never needed such a function so I can't say, but my guess is no, you can't do that.

    If that is the case, it should be trivial for Ashley to implement it. If he's too busy or you need this urgently, it's pretty easy to grab the SDK and do it yourself - heck, I'd bet someone on the chat would be willing to do it for you!

  • I think he means via events.

    Oh sorry, I forgot to mention that.

    Yes, go to the projects bar on your right, and look in the layouts folder. If this makes no sense, go to the VIEW tab on the top of construct2 and check off "Project Bar"

    I'm not an idiot, I know how to look in the list of layouts, but I don't know how to teach the game to do that. <img src="smileys/smiley17.gif" border="0" align="middle" />

  • You can't create layouts at runtime, so existing layouts are those you made/named yourself.

    To check the current layout's name make a system "compare two values" event, and check for the system expression "LayoutName" and "The_name_you_want".

  • Kyatric, doesn't LayoutName return the name for the current layout only?

    I don't think there's a way to iterate over all available layout names, the only workaround (which is a bit of a hack) is to create an array, fill it with layout names, and iterate over that instead.

  • If you need to iterate, just use a variable in "The_name_you_want".

    Something like:

    Loop VariableValue from 0 to 10

    .. Layoutname = "Level" & VariableValue

    It will make sure that the current layout name is "Level0" and then "Level1", etc...

    But once again, as a creator, you know how many and what the name of the layouts are, anyway, since you made them at edittime.

    I really don't see the problem here.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I was trying to find a way to have a level selection menu be automatically generated. Until this is possible, I'll use Kyatric's idea. Thanks.

  • Zephlon: do you mean something like this ?

  • Kind of. I have a level selection menu made:


    I was hoping to have the game check if each level exists, and mark the ones that don't as "Coming Soon". I guess I'll just leave it as it is.

    But one thing I can't figure out is how to have multiple pages of levels, and a sliding animation to switch between them. Angry Birds's level select menu has this. I tried having the level buttons in the own layer, and setting the parallax on the other layers to "0,0", but that caused those layers to appear too far up and left.

  • Zephlon, I found that with Parallax layers you have to check off the box that says Show in Editor. Then move them over in the preview. It might be easier to move them in place with events than using layers?

  • My first game is almost ready, all levels are finished (after almost 2 months of tough work), the only thing i need to do now are the menus... if someone can show me the basics how to make a menu like on Poggle game, i need all levels to be visible in the menu but they need to be locked as in Poggle, than after the first level is finished the second to be unlocked and so on.

    i guess Zephlon can answer me :), by the way, your game is very addictive hihi.


  • The basic idea is that, at the end of a level, you store the highscore in a database of some kind (I used the WebStorage object). Then you create a sprite on the level select menu with one animation for unlocked, and one for locked. Then at the start of the layout you iterate through all of the levels and if the previous level has a highscore greater than zero, unlock it.

    I can explain in more detail, but I'll need to know if you want the menu to be automatically generated and if you want multiple pages.

  • Hey, please check this capx. this is how far i can get... you`ll just need to add some events to help me.



  • First, you can have more than one layout share the same event sheet. Second, each of the level boxes should be multiple instances of the same object. (Create the first one, name it, and then move it while holding ctrl to copy. Or, right-click>copy, then right-click>paste.) To have multiple frames for one object, open the first one, create a new frame (right-click in the frames window, click add frame), make sure the new frame is selected, and open the next image.

    Try this:


    Does your game keep track of score? If not, we'll need to do this differently; because this is like a level select menu and high-score system in one.

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