How do I use shared layouts?

Get help using Construct 2

Post » Sat Sep 10, 2016 3:35 pm

Hello all,

I have 3 game modes, which uses all of the "classic" game mode objects, in addition to their own mode changes.
Is there a way to "Extend" the layout, or to share it, other than cloning it for each game mode? this will force me to add objects to all layouts if I'm developing the game further.

I know I can have global objects, but this will require me to go through each object and use "Create Object" on them before I can use them, since they are there for reference only (global object don't appear in each layout as well, but they can be referenced from every other layout).

Thanks!
B
18
S
7
G
1
Posts: 157
Reputation: 1,928

Post » Sat Sep 10, 2016 4:05 pm

Can you give me a short example in a form of explanation of what you are trying to achieve?
If you are talking about objects being global from 1 layer from a layout to another layer with the same name from another layout, then you can use global layers .

Reference:
https://www.scirra.com/tutorials/594/bu ... terface-ui
https://www.scirra.com/manual/85/layers
inherited-layer-cross-multiple-layouts_t76247
The Things you can create is only limited by your imagination. If you don't have the skills then use your motivation as a natural force to exceed all expectations. Chadori RebornXD
B
63
S
18
G
90
Posts: 1,118
Reputation: 59,540

Post » Sat Sep 10, 2016 4:12 pm

By Game mode you mean layouts? If so, yes. You need to clone them. Althought It all depends of what you are trying to do. If game mode changes means just changing some values, creating objects and other dynamic stuffs then you can do it in the same layout and use variables to determine in which level the player is. If means to change the entire world of that layout then starting a new layout is needed.
Bear in mind that construct works this way. If you want to use any object you have to have at least one instance example in the layout start. Most of the people delete objects on start of the layout and the rest is done by routines on the events.
Edit: Also I think you are miss understanding the use of objects. Unless you are doing a super simple game where you only use instances that you already have on the start of layout, you will always handle objects creation/destroy by events.
B
56
S
21
G
3
Posts: 602
Reputation: 6,612

Post » Sat Sep 10, 2016 4:47 pm

chadorireborn wrote:Can you give me a short example in a form of explanation of what you are trying to achieve?
If you are talking about objects being global from 1 layer from a layout to another layer with the same name from another layout, then you can use global layers .

Reference:
https://www.scirra.com/tutorials/594/bu ... terface-ui
https://www.scirra.com/manual/85/layers
inherited-layer-cross-multiple-layouts_t76247


Thanks @chadorireborn! Global Layers ROCK! :) Now I only add new layers per game mode, and reuse the rest :)
B
18
S
7
G
1
Posts: 157
Reputation: 1,928

Post » Sat Sep 10, 2016 4:54 pm

@kossglobal, like I wrote in the first post, They have most of the UI in common, although in each game mode some additional UI elements are present. Didn't see the need to clone layout, and every time I add a "shared" ui object, add them in all layouts.

Global Layouts were the answer to that, since now I can define shared layouts, and put the per-game-mode UI objects in their own respective layouts.

Up until now, I did use create/destroy methods in my game screen, and I'm well aware about the one instance thingy :) Thanks for pointing that up again, though :)
B
18
S
7
G
1
Posts: 157
Reputation: 1,928

Post » Sat Sep 10, 2016 5:03 pm

trueicecold wrote:@kossglobal, like I wrote in the first post, They have most of the UI in common, although in each game mode some additional UI elements are present. Didn't see the need to clone layout, and every time I add a "shared" ui object, add them in all layouts.

Global Layouts were the answer to that, since now I can define shared layouts, and put the per-game-mode UI objects in their own respective layouts.

Up until now, I did use create/destroy methods in my game screen, and I'm well aware about the one instance thingy :) Thanks for pointing that up again, though :)


Well, you didn't mention UI elements. In this case I'd have suggested you global layers but not for actual game if you know what I mean.
B
56
S
21
G
3
Posts: 602
Reputation: 6,612


Return to How do I....?

Who is online

Users browsing this forum: leena222, mindragon73, tatogame and 22 guests