How do I make a single button toggle a menu?

0 favourites
  • 8 posts
From the Asset Store
A well commented template with list menus and shops to use in your top-down RPGs or metroidvania games!
  • I'm beginning my adventure into menus, starting with a basic ability menu that lets the player switch from fireballs to ice balls.

    My objective is simple, press Y to bring up the menu, and press Y again to close it. Simple enough, yet I am clearly doing something wrong because it's not working. When I change the closing button to something other than Y it works, so there is something that I'm not getting when it comes to using the same button for a multi-function purpose.

    My idea was to make the menu initially invisible, and if it was invisible press Y brings it up (and pauses the game), and when the menu is visible when Y is pressed, it goes away and the time scale is also restored.

  • I'm guessing that your issue is that when you press y for the first event your making the conditions correct for the second event to immediately trigger and vice versa.

  • Try putting a "Wait 0" after "Set visible/invisible"

  • I have fixed the issue of making the Y button "toggle" the menu, and it works. However, it brings up another problem:

    I have a basic projectile launcher that shoots a missile in a straight line. When the game is paused everything "pauses" fine except that the player can keep pressing X to spawn these missiles in place and they all launch out at once when the game is unpaused.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • put a check on the 'x' to only read when the pause menu is off.

  • Thanks that worked, and thanks again to everyone else that gave help for the first problem too.

    Is that the best way to do it though? (for the firing issue) I'm new to events and I want to make sure everything is as optimized and as neat as possible. Construct can hold a large volume of Event systems right?

  • You could think about grouping checks and events so as to reduce the number needed.

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