Swapping between Menu

Get help using Construct 2

Post » Sat Oct 05, 2013 7:33 pm


Hello world.

I've been developing a game for a couple of months and learning in the process. I should have chosen an easier game to make...

The Forum has been a great source of information. Whenever I got stuck I would come here and search for a thread with a problem similar to mine. Alas, I'm stuck and haven't found one regarding my problem.

I simply want to swap between menus. The layout of my game has all the different menu buttons at the bottom. I've made it working to the point where clicking the buttons shows/hides the assigned menu but I can't figure out how to swap if one menu is already being shown.

This is what happens: Press Character Button > Character Menu shows
then press Items button > Item Menu shows on top of Character.

I want: Press Character Button > Hides all Menus > Character Menu shows
then press Items button > Hides all Menus > Item Menu shows.

I simply need to get rid of any Menus as I click on the Menu Button and create the assigned Menu.

The problem is a lot more simple than it sounds, yet too complicated for me to solve.

Capx to show what where I am.

Thank you.

tl;dr

I want to reset all the menus every time I click on a Menu button THEN show the last clicked button's Menu.

Cheers.
B
10
S
1
Posts: 17
Reputation: 642

Post » Sat Oct 05, 2013 9:58 pm

The way I do it is to put each menu into a group and then enable/disable the menus I want. The .capx doesn't show much but this is how I would go about getting what you want.
B
46
S
16
G
73
Posts: 2,084
Reputation: 43,677

Post » Sat Oct 05, 2013 10:05 pm

[QUOTE=plinkie] The way I do it is to put each menu into a group and then enable/disable the menus I want. The .capx doesn't show much but this is how I would go about getting what you want.[/QUOTE]

I can enable and disable the menus as shown in the capx. What I want to do is to delete Menu One when Menu Two is shown and vice versa. Any ideas?
B
10
S
1
Posts: 17
Reputation: 642

Post » Sat Oct 05, 2013 10:10 pm

If you can disable menus then what is the problem? I click Menu One and Menu One appears. I click Menu Two and Menu Two appears etc. They are only text objects anyway. What exactly are the menus as all I can see are text objects?
B
46
S
16
G
73
Posts: 2,084
Reputation: 43,677

Post » Sat Oct 05, 2013 10:21 pm

Well this is a very simplified version of what I'm actually doing. The actual menus are composed of a background, texts and a few sprites.

If you click on all of the menu buttons once you'll see the text overlaps and, more importantly, the variable "Selected" stays "True" on all the buttons. Do you know of a way to set the variable "Selected" to "False" to all of them as I click on any button?

Thanks @plinkie
B
10
S
1
Posts: 17
Reputation: 642

Post » Sat Oct 05, 2013 10:28 pm

You want some logic such as :

1. When any button clicked : Run Function "Hide All"

This would hide all the menu components with the Set Visible action.

Then you have separate logic such as :

2. When Item Button clicked : Run Function "Show Item Menu"

This function would contain logic that sets the Item menu to visible.

This is all done with "Set Visible". Also I would not be using cloned buttons as in that example. Set up buttons with different names such as "ItemMenu_Button" "CharacterMenu_Button" etc.
B
46
S
16
G
73
Posts: 2,084
Reputation: 43,677

Post » Sun Oct 06, 2013 1:24 am

Not sure how if you've solved your problem yet...

On my Evade game I used separate LAYERS for each Menu screen, this way I could just hide/unhide the layers I needed.

Click Button "scoreboard"
-> Hide "mainmenu" Layer
-> Show "scoreboard" Layer

Click Button "scoreboard_back"
-> Hide "scoreboard" layer
-> Show "mainmenu" layer

Then any button events etc I had for the "mainmenu" I would nest inside a check visible event...

Layer "mainmenu" is visible
-> check buttons for mainmenu
-> perform updates etc

Layer "scoreboard" is visible
-> check buttons for scoreboard
-> perform updates etc
B
8
S
3
G
1
Posts: 34
Reputation: 1,395

Post » Sun Oct 06, 2013 2:14 am

@arcosta @arontwose

Yeah go with this idea. Much less stuff required than mine. neat! : D
B
46
S
16
G
73
Posts: 2,084
Reputation: 43,677

Post » Sun Oct 06, 2013 6:51 pm

@arontwose

I like your idea. I did see it being suggested on other threads but didn't quite get the concept. You've put it very easy to understand. Thanks a lot and may your day be filled with good things.

@plinkie

Thank you for replying and helping me on my problem. Take care.

I know this will be enough to finish this part of the game. Thanks guys.
B
10
S
1
Posts: 17
Reputation: 642


Return to How do I....?

Who is online

Users browsing this forum: Baconizer, David181, nahima, Shenkai the ssj and 21 guests