How do I stop a button being pressed twice?

Get help using Construct 2

Post » Thu Dec 08, 2016 10:45 am

Hi,

I've got a green button that charges a power bar and when released a bomb is fired, the longer you hold the button the more power the bomb gets and goes faster.

But if the player presses the button before the bomb is destroyed that bomb hangs in the air at the place it was when the button was pressed again and the same bomb is shot out again.

Is there a way to disable the power button once it's been released until the first bomb is destroyed?
So I can then shoot the 2nd bomb (3 bombs in total)

I've tried:
disable event and wait x seconds and enable
Adding a variable and when = 0 wait (also tried disable event)

They didn't work.

Here's my code, any help would be great. Thank you

Image
B
10
S
3
Posts: 55
Reputation: 802

Post » Thu Dec 08, 2016 11:59 am

Take the entire "On any touch end" statement out of the sub-event.

Highlight "On any touch end", press CTRL + X, high light the group, press CTRL + V.
Image Image Image
B
31
S
11
G
27
Posts: 748
Reputation: 17,093

Post » Thu Dec 08, 2016 1:48 pm

Hi

Thank you for your reply.

I've just tried what you said, I not 100% sure if I did it right, here's what I done:

1st I moved the 'On any touch end" out of the sub event making it not a sub event but it is still in the group, that didn't work.

2nd I highlighted the 'On any touch end" and pressed CTRL + x which deleted only the wording, the events stayed there, I highlighted the 'group' (where the group name is) but it wouldn't allow me to press CTRL + v, so I highlighted just under the group (so the whole of the group lit up except the group name) I then CTRL + v, that pasted 'On any touch end" right about the touch green button part.
This kinda worked and stopped me from firing the bomb while the first one was still active in the game.
But it stopped the power bar going up which didn't allow the bomb to go at the speed that it would have for holding down the button for a time.

Sorry if I've misunderstood what you've wrote.
Thanks
B
10
S
3
Posts: 55
Reputation: 802

Post » Fri Dec 09, 2016 1:47 pm

I've managed to do it, I'll paste below what I've done in case someone else needs help.
So many times I've seen people ask questions and then at the bottom of the page they write "Never mind I've done it" but they don't tell us what they done :(

Image
B
10
S
3
Posts: 55
Reputation: 802

Post » Fri Dec 09, 2016 2:05 pm

On any touch end (a trigger) should be no sub event.

Grab that event on the left side, drag it above that 'is touching' event (and under that comment line), in a way that aligns perfectly on the left.
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Fri Dec 09, 2016 3:39 pm

Oh right, ok thank you.

Still learning it :(

Thanks
B
10
S
3
Posts: 55
Reputation: 802


Return to How do I....?

Who is online

Users browsing this forum: No registered users and 36 guests