[SOLVED] How to test if a control is pressed two times ?

For questions about using Classic.

Post » Wed Feb 09, 2011 7:11 pm

Hello everyone !

This time, I need help with this : "How to test if a control is pressed two times ?"
I want to know that for my project. I wanna do a Running System in that way (like some retro games) :

Right Control pressed 2 times = RUN
Right Control pressed 1 time = WALK


Left Control pressed 2 times = RUN
Left Control pressed 1 time = WALK
B
6
S
1
G
3
Posts: 61
Reputation: 1,072

Post » Wed Feb 09, 2011 7:17 pm

The first thing that comes to mind is something along these lines:

Have a timer of a few hundred milliseconds start counting down once either left or right is released -- if the player hits that same button again before the timer hits zero, start running instead of walking. You can change the length of the timer to affect how quickly the player has to press the button to run.

I can't guarantee it'll work, but that's what I'd try. Lemme know if it fails miserably. :P
B
20
S
9
G
6
Posts: 607
Reputation: 6,112

Post » Wed Feb 09, 2011 7:41 pm

SullyTheStrange was a bit quicker.

Here's a cap, basically doing, what Sully described.

doublepress.cap
Image
B
23
S
8
G
10
Posts: 1,820
Reputation: 8,242

Post » Wed Feb 09, 2011 8:01 pm

Thanks to both of you. It works !
B
6
S
1
G
3
Posts: 61
Reputation: 1,072


Return to Help & Support using Construct Classic

Who is online

Users browsing this forum: No registered users and 2 guests