Call layer from a different layout?

Get help using Construct 2

Post » Wed Feb 22, 2012 10:46 pm

I am going to create an in-game menu in the form of a separate layer so on start of layout, set layer invisible then on pressing the 'pause' button, set layer visible etc etc

However, instead of having to recreate the same layer and all the objects that go with it, over and over again for all of my levels, is it possible to give the one layer a name and call it to the front of the current layout?

Or if I am going about this in completely the wrong way, can anyone give me any suggestions please?
ImageImage
Mr. Green - Platform/puzzle game out now!
B
24
S
7
G
1
Posts: 222
Reputation: 3,325

Post » Wed Feb 22, 2012 10:58 pm

As far as I know that's not possible I'm afraid (And if it is then I really wish I knew that!). Your best bet is probably just to create a new Layer on each Layout, but then dynamically create the actual menu on that layer when they press Pause, if you don't want to copy and paste it to each Layout.

So, create 'MenuBackground' on PauseLayer at whichever position, and then create all the options on top. You'd only have to do that once as you can just use those events across all Layouts.

Someone who knows more might have a better solution though!
B
22
S
6
G
10
Posts: 118
Reputation: 8,005

Post » Wed Feb 22, 2012 11:06 pm

Ah ye, that's one way round the problem. I'll give that a go, thanks.

However, it would be reaaaaally useful to be able to "call 'layername' to current layout" wouldn't it!?! :D
ImageImage
Mr. Green - Platform/puzzle game out now!
B
24
S
7
G
1
Posts: 222
Reputation: 3,325

Post » Wed Feb 22, 2012 11:12 pm

Construct Classic had an option for that, called Inheritance Layer. It'd be nice to see that make a return.

For now, a method R0J0hound suggested to me that I've taken to using is to have my HUD and menus and such being set as global objects (that way they persist from layout to layout, useful for complicated HUDs) and then having them created at startup, while having a separate event sheet handle all the necessary events for HUD/menu management that I can just include in other layouts. Works rather nicely.
B
56
S
20
G
7
Posts: 305
Reputation: 8,754


Return to How do I....?

Who is online

Users browsing this forum: Rezzon71, tarek2 and 25 guests