Page 1 of 1

Double Click on keyboard

PostPosted: Sun Jul 29, 2012 12:45 pm
by ayman
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.

Re: Double Click on keyboard

PostPosted: Sun Jul 29, 2012 2:20 pm
by Yann
[code]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)[/code](pay attention to what is in sub event)Yann2012-07-29 14:25:15

Re: Double Click on keyboard

PostPosted: Thu Aug 09, 2012 3:18 am
by ayman
thanks :)

Re: Double Click on keyboard

PostPosted: Fri Feb 22, 2013 8:36 pm
by Hillstrom
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.

Re: Double Click on keyboard

PostPosted: Sat Feb 23, 2013 8:19 pm
by Hillstrom
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

Re: Double Click on keyboard

PostPosted: Sat Feb 23, 2013 8:56 pm
by kkmultes
Hillstrom, i think the example that Yann post, could be usefull for you

Re: Double Click on keyboard

PostPosted: Sun Feb 24, 2013 3:52 am
by Hillstrom
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