If layout exists

Get help using Construct 2

Post » Tue Mar 20, 2012 3:35 am

Is there a way to check if a layout with a given name exists?
B
25
S
8
G
8
Posts: 71
Reputation: 5,307

Post » Tue Mar 20, 2012 3:44 am

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"
B
20
S
4
G
4
Posts: 129
Reputation: 5,535

Post » Tue Mar 20, 2012 3:48 am

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!Fimbul2012-03-20 03:50:33
B
35
S
8
G
8
Posts: 532
Reputation: 6,868

Post » Tue Mar 20, 2012 5:22 am

[QUOTE=Fimbul] I think he means via events.[/QUOTE]
Oh sorry, I forgot to mention that.

[QUOTE=StephenC] 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"[/QUOTE]
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.
B
25
S
8
G
8
Posts: 71
Reputation: 5,307

Post » Tue Mar 20, 2012 8:47 am

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".

Kyatric2012-03-20 08:48:00
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 » Tue Mar 20, 2012 3:11 pm

@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.
B
35
S
8
G
8
Posts: 532
Reputation: 6,868

Post » Tue Mar 20, 2012 10:33 pm

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.
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 Mar 21, 2012 12:07 am

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.
B
25
S
8
G
8
Posts: 71
Reputation: 5,307

Post » Wed Mar 21, 2012 12:39 am

@Zephlon: do you mean something like this ?
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 Mar 21, 2012 3:02 am

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.
B
25
S
8
G
8
Posts: 71
Reputation: 5,307

Next

Return to How do I....?

Who is online

Users browsing this forum: Yahoo [Bot] and 22 guests