Swapping between Menu

0 favourites
  • 9 posts
From the Asset Store
Full game Construct 2 capx code source to post on Google Play
  • 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.

  • 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.

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • 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.

    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?

  • 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?

  • 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

  • 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.

  • 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

  • Arcosta arontwose

    Yeah go with this idea. Much less stuff required than mine. neat! : D

  • 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.

    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.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)