How do I stop a button being pressed twice?

0 favourites
  • 6 posts
From the Asset Store
J-BoB Game Button Sound Pack comes with 300 high-quality sound effects
  • 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

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

  • Try Construct 3

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

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

  • 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

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

  • Oh right, ok thank you.

    Still learning it

    Thanks

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