Double-press buttons

0 favourites
  • 10 posts
From the Asset Store
A set of retro 16-Bit Neon UI elements to make your menus pop!
  • Did a search and could only find construct classic bits and pieces which weren't entirely relevant.

    I have my character with the required animations:

    Single punch

    Double punch

    Pressing the A key triggers the single punch animation.

    I can't work out properly how to have the double punch animation trigger instead if the A key is pressed twice within a short space of time (200-300ms for example)

    Thanks ahead for any help :)

  • You probably have two variables on your player. One called "DoublePunch" and another one called "DoublePunch_Toggled" or something like that.


    When A is pressed:   (Punch)

                                   Set DoublePunch to 1

    When A is pressed     Set DoublePunch_Activated to 1

    DoublePunch is = 1

    When A is Pressed

    DoublePunch_Toggled = 1 (Double Punch)

                                            Set DoublePunch to 0

                                            Set DoublePunch_Toggled to 0

    Now you can Double Punch, but you can also do it after 200-300 ms.

    So, you need to add a "Wait" action when A is pressed:

    When A is pressed: (Punch)

    DoublePunch = 1      Wait 200/300 ms

                                    Set DoublePunch_Activated to 0

                                    Set DoublePunch to 0

    I am not sure if this will work, try it.

    And maybe upload a .capx, if it doesnt work!


  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Cheers, I'll give it a try now :)

  • Super, and please upload a .capx so i can take a look at it, if it doesn't work:)

  • Didn't work,

    Here is the file

    The events in particular are at bottom of event sheet.


  • If anyone else has a suggestion, please don't hesitate to comment :)

  • Not sure if wait will work as that code won't accept any other input during the wait if I am not off in my thinking. That is the point of the wait.

    I could be wrong though.

  • The wait command didn't work, I thought it ignored input too

  • Damn, i'll take a deeper look tommorow when i get home :P

  • Hello. First post. Love Construct2.

    Also in need of similar method. If player press x only once, block. If player double-press x, then dodge. Sounds easy. Couldn't make it work. Timers and stuff getting messy.

    Sound something so intuitive that there should be a topic or even a behaviour support for it. Also double tap for touchscreen.

    Best Regards.

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