How do I use the same button on all my layouts

Get help using Construct 2

Post » Sat Nov 22, 2014 7:53 am

I am working with a number of layouts for an RPG game. I have been adding the same command buttons on every layout with the same code for each one. "Attack, Defend, Spell, etc). For example in the forest, swamp, and desert layout
Is there a way to use the same set of button on every one of my existing layouts? Example?

Thanks
B
29
S
8
G
8
Posts: 531
Reputation: 7,181

Post » Sat Nov 22, 2014 8:12 am

Hi @Guyon, I'm not sure I understand what problem you're having. Could you clarify please? Cheers.
Image
B
9
S
3
G
1
Posts: 346
Reputation: 1,560

Post » Sat Nov 22, 2014 11:30 am

Look into global layers.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Sat Nov 22, 2014 7:54 pm

Let me try and explain better.
Right now my game has seven layouts. I have buttons with the same name on each layout. So I have to copy the same code to each button on each layout.

Is there a way to just make one button that will will show up on all layout and just have one set of code?

@codah I am not sure what you mean. can you explain?
B
29
S
8
G
8
Posts: 531
Reputation: 7,181

Post » Sat Nov 22, 2014 8:00 pm

@Guyon If I understand you correctly you're talking about the code, which is on the event sheet. If you're using separate event sheets for each layout you could write a standalone event sheet for those buttons and just "include" it into each of your layout event sheets.
Image
B
9
S
3
G
1
Posts: 346
Reputation: 1,560

Post » Sat Nov 22, 2014 9:06 pm

I seem to recall something about that hundredfold. Is there a tutorial someplace?
Do I even use a layout for what I want to include or just the event sheet?
Thanks
Last edited by Guyon on Sat Nov 22, 2014 9:09 pm, edited 1 time in total.
B
29
S
8
G
8
Posts: 531
Reputation: 7,181

Post » Sat Nov 22, 2014 9:09 pm

Global layers are layers that you can reuse from layouts to layouts, which could be part of the hud

https://www.scirra.com/manual/85/layers
Game design is all about decomposing the core of your game so it becomes simple instructions.
B
53
S
22
G
18
Posts: 2,122
Reputation: 17,123

Post » Sat Nov 22, 2014 9:28 pm

Aphrodite, I am not sure layers will help as I need my buttons with code to appear on different layout,. I think the include is what I want but looking for a tutorial or example.

I found this but still missing how to add my buttons to different sheets
https://www.scirra.com/manual/82/includes
https://www.youtube.com/watch?v=4Wx9E6zIyiI
B
29
S
8
G
8
Posts: 531
Reputation: 7,181

Post » Sun Nov 23, 2014 1:00 am

Guyon wrote:
@codah I am not sure what you mean. can you explain?


Did you search "global layers" in the manual? They will give you common UI across layouts. Then to get common events, you "include" event sheets that handle the UI on those layouts.
B
24
S
9
G
4
Posts: 1,646
Reputation: 6,596

Post » Sun Nov 23, 2014 1:32 am

B
29
S
8
G
8
Posts: 531
Reputation: 7,181


Return to How do I....?

Who is online

Users browsing this forum: Google [Bot], moebios and 9 guests