Double Click on keyboard

0 favourites
  • 7 posts
From the Asset Store
Total customisation of the input! You can combine inputs from all peripherals. Make your game accessible for everyone!
  • Greetings,

    How can I detect double click on keyboard? I want to perform a dash if the user click "D" two times and fast. Think of rock-man (mega-man).

    thanks.

  • Global number Dtimer = 0 // timer for the D key
    Global number sensibility = 0.4 // time in second between two D pressed
    + On D pressed
      + Dtimer greater than 0
        -> set Dtimer to 0
        -> it's a double D pressed set your action here
      + Else
        -> set Dtimer to sensibility
    + Every Ticks
      -> set Dtimer to max(0,Dtimer-dt)

    (pay attention to what is in sub event)

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • thanks :)

  • Sorry to resurrect an old topic from someone else. But I think is better than overpopulate the forum with the same questions.

    In regard to actions performed on quicks double taps of a button.

    This works too for double clicks/touchs?

    I need an object to perform two different actions, one when you click on it and another when you double click it.

    The problem is that the double click is overriden by the first click action. So i get the two actions performed at once.

    I believe that double click on an object takes into account a timer similar to your "sensibility" variable internally. So to differentiate from single clicks.

    Your implementation should help in my case with mouse clicks as it helps with keyboard buttons.

    But i'm missing something with the default "on <button< double clicked" from C2 engine? It should not prevent intrusions of events for single clicks? I'm puzzled with this :(

    Thanks and sorry for my smuggling.

  • I whould appreciate some directions here. I have the impression that i overcomplicate a simple mechanic.

    If a click on an object do an action, and a double click on the same object do another action, How do i prevent the first click to override the double click action?

    I need some kind of delay, so if a second click happends quickly it doesn't count as a one click action.

    The double click on object doesn't do this automatically :S

    Maybe I have to make an individual post for this

  • Hillstrom, i think the example that Yann post, could be usefull for you

  • Yes, it helped me but since there's an already division between click and double click i supposed that this built-in event would take into account internally what yann did. Like a buffer or timer of inputs.

    In the end i changed completely my two events so this will not be an issue to me. But i would had liked a better control between clicks and double clicks for actions.

    For now long road seems the only road to use.

    Thanks all anyway

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