How do I make a single button toggle a menu?

Get help using Construct 2

Post » Thu Jan 01, 2015 9:59 pm

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.

Image

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.
B
20
S
5
Posts: 108
Reputation: 1,473

Post » Thu Jan 01, 2015 11:23 pm

Read this:
yeah, i really like to say that you should "Read this:"
B
12
S
5
Posts: 138
Reputation: 1,490

Post » Thu Jan 01, 2015 11:44 pm

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.
B
61
S
20
G
56
Posts: 1,077
Reputation: 35,986

Post » Fri Jan 02, 2015 12:29 am

Try putting a "Wait 0" after "Set visible/invisible"
Check our 2D assets platform!

http://ask4asset.com
B
7
S
1
Posts: 13
Reputation: 715

Post » Fri Jan 02, 2015 3:14 am

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.

Image
B
20
S
5
Posts: 108
Reputation: 1,473

Post » Fri Jan 02, 2015 9:24 am

put a check on the 'x' to only read when the pause menu is off.
Some games: https://play.google.com/store/search?q= ... s&hl=en_GB Feel free to show the panda some support, he would appreciate it :)
B
19
S
5
G
1
Posts: 155
Reputation: 1,619

Post » Fri Jan 02, 2015 11:06 am

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?
B
20
S
5
Posts: 108
Reputation: 1,473

Post » Fri Jan 02, 2015 1:15 pm

You could think about grouping checks and events so as to reduce the number needed.
Some games: https://play.google.com/store/search?q= ... s&hl=en_GB Feel free to show the panda some support, he would appreciate it :)
B
19
S
5
G
1
Posts: 155
Reputation: 1,619


Return to How do I....?

Who is online

Users browsing this forum: MassimoF and 25 guests