Double Click on keyboard

Get help using Construct 2

Post » Sun Jul 29, 2012 12:45 pm

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.
B
4
Posts: 4
Reputation: 733

Post » Sun Jul 29, 2012 2:20 pm

[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
B
60
S
22
G
14
Posts: 1,479
Reputation: 16,346

Post » Thu Aug 09, 2012 3:18 am

thanks :)
B
4
Posts: 4
Reputation: 733

Post » Fri Feb 22, 2013 8:36 pm

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.
B
31
S
4
G
4
Posts: 110
Reputation: 4,588

Post » Sat Feb 23, 2013 8:19 pm

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
B
31
S
4
G
4
Posts: 110
Reputation: 4,588

Post » Sat Feb 23, 2013 8:56 pm

Hillstrom, i think the example that Yann post, could be usefull for you
B
6
Posts: 25
Reputation: 539

Post » Sun Feb 24, 2013 3:52 am

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
B
31
S
4
G
4
Posts: 110
Reputation: 4,588


Return to How do I....?

Who is online

Users browsing this forum: Governador, Radulepy, tarek2, Thelegendvinny, TiagoCesar and 24 guests