Get current layer name

Get help using Construct 2

Post » Sat Feb 02, 2013 3:15 pm

In an event how do I get the current layer name?

i.e. I want to compare an instance variable to see if it matches the layer name of the currently active layer. Then I can make a sprite invisible if it isn't bound to a layer.. thus retaining object state. I need to do this because I can go in and out of rooms, pickup stuff one time only.
B
20
S
6
G
2
Posts: 157
Reputation: 3,109

Post » Sat Feb 02, 2013 3:17 pm

Sorry I mean LAYOUT name not layer name.

So if I have
Layout1<>MainEventSheet
Layout2<>MainEventSheet

A global sprite with an instance variable "BoundLayout" = "Layout1"

On my main event sheet I want to "at start of layout" set any sprites that aren't on this layout to visible = false.

So then if I use global sprite objects can show/hide depending on current layout.

B
20
S
6
G
2
Posts: 157
Reputation: 3,109

Post » Sat Feb 02, 2013 8:42 pm

Can you do something like?

On start of layout
(subevent)If LayoutName = Sprite.LayoutName then (actions)

where Sprite.LayoutName is an instanced text variable.
B
12
S
4
G
2
Posts: 59
Reputation: 3,739


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 31 guests