calling layout..?

Get help using Construct 2

Post » Sat Mar 23, 2013 10:50 pm

I am working on a game. and I have built several layouts (play area(numerous layouts), map, hud, inventory, battle) what i want to achieve is having the play area as my main layout with the hud layout supper imposed over it, I know that i could use layers to add the the hud to each play area layout, but think there mist be an easier way.

I also want to be able to call other layout eg inventory, without losing the progress of the main layout. eg play opens inventory to check what he is holding, and then closing the inventory and is still in the same position as they were before they opened the inventory.

hope this makes seance.
B
10
S
4
G
3
Posts: 53
Reputation: 2,613

Post » Sun Mar 24, 2013 5:09 am

Think you can make all the objects on the layouts global, that will not destroy them on "end of layout". However havent tried it a lot. So not sure if it can do what you need.
B
40
S
10
G
2
Posts: 1,151
Reputation: 6,501

Post » Sun Mar 24, 2013 7:58 am

layouts are completely separate you can't show one on top of the other, that is what global objects and layers are for.
B
49
S
11
G
10
Posts: 1,833
Reputation: 14,428

Post » Sun Mar 24, 2013 1:34 pm

so in theory if a put my hud on a layer called hud in a layout and made all the sprites global and made a hud event sheet that made all the sprites visible then on all my other layouts made a blank layer called hud, and in the event sheets for those layouts put an include event sheet command to the hud event sheet, then the hud should work in all layouts
B
10
S
4
G
3
Posts: 53
Reputation: 2,613

Post » Sun Mar 24, 2013 2:42 pm

Actually, that's a pretty smart idea.

I played around with it and it indeed works. Only issue is that it comes in at the bottom of the z-order on the bottom-most layer, but that's an easy fix.

I'd suggest adding all of your UI elements to a family (or two families, if you have a mix of sprites and text objects) and then, at the start of each new layout either send the entire family to the top-most layer in your layout (in the case of actual in-game layouts) or to an invisible layer at the bottom (in the case of menu or option screens). Regardless of the layout you're on, you'll always have to find something to do with your UI elements.
B
56
S
15
G
10
Posts: 910
Reputation: 11,972

Post » Sun Mar 24, 2013 9:37 pm

I have been playing around with this and it works just as i want, and all I had to do for the z layer problem was add a move to to command. happy days. oh and the hud layout had to be the first in order, so that the graphics loaded into the system
B
10
S
4
G
3
Posts: 53
Reputation: 2,613


Return to How do I....?

Who is online

Users browsing this forum: flemmig, MisterAqua, Nifl and 29 guests