If layout exists Forum Home > Construct 2 General > How do I....? |
Post Reply
|
Page 12> |
| Author | ||
Post Options
Quote Reply
Topic: If layout existsPosted: 20 Mar 2012 at 3:35am |
||
|
Is there a way to check if a layout with a given name exists?
|
||
![]() |
||
Post Options
Quote Reply
Posted: 20 Mar 2012 at 3:44am |
||
|
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"
|
||
![]() |
||
Post Options
Quote Reply
Posted: 20 Mar 2012 at 3:48am |
||
|
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! Edited by Fimbul - 20 Mar 2012 at 3:50am |
||
![]() |
||
Post Options
Quote Reply
Posted: 20 Mar 2012 at 5:22am |
||
Oh sorry, I forgot to mention that.
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.
|
||
![]() |
||
Post Options
Quote Reply
Posted: 20 Mar 2012 at 8:47am |
||
|
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". Edited by Kyatric - 20 Mar 2012 at 8:48am |
||
![]() |
||
Post Options
Quote Reply
Posted: 20 Mar 2012 at 3:11pm |
||
|
@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. |
||
![]() |
||
Post Options
Quote Reply
Posted: 20 Mar 2012 at 10:33pm |
||
|
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. |
||
![]() |
||
Post Options
Quote Reply
Posted: 21 Mar 2012 at 12:07am |
||
|
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.
|
||
![]() |
||
Post Options
Quote Reply
Posted: 21 Mar 2012 at 12:39am |
||
|
@Zephlon: do you mean something like this ?
|
||
![]() |
||
Post Options
Quote Reply
Posted: 21 Mar 2012 at 3:02am |
||
|
Kind of. I have a level selection menu made:
http://dl.dropbox.com/u/52788071/Poggle/index.html 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. |
||
![]() |
||
Post Reply
|
Page 12> |
| Forum Jump | Forum Permissions ![]() You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum |