How do I recognize the time a button/element is pressed

Get help using Construct 2

Post » Tue Dec 08, 2015 2:31 pm

Hi guys,

somehow I am thinking too complicated to get a simple Task done (resource friendly, at least).

When the Player presses the "Action" button/key, he should hold it for X seconds, untill the function/Action is executed.

How on earth is this doable? Do I really Need a variable for it? Tryed Things with "wait" Action, but I think "pausing" isnt really what I Need here...

Can someone blow to the back of my head, please? :?

(Sorry for the grammar, Edge is Messing other languages than System language up..)
B
24
S
14
G
9
Posts: 118
Reputation: 6,799

Post » Tue Dec 08, 2015 2:44 pm

You could do it with timer behaviour..

On any touch start
touch is touching button
>start timer for 3 seconds

on timer
touch is touching button
> perform action

on any touch end
> stop timer
I told my dentist I had trouble with my teeth and asked her to fix it without looking in my mouth..
B
54
S
16
G
8
Posts: 6,160
Reputation: 19,775

Post » Tue Dec 08, 2015 5:32 pm

Here's a solution with 1 variable:

Is Touching Object (Button)         Add 1 to variable
Every 1 seconds

On any Touch End                         variable set to 0

If variable = X seconds                  Do Action
B
10
S
2
Posts: 109
Reputation: 982

Post » Tue Dec 08, 2015 6:41 pm

Thanks for the answers,

sometimes I think too complex for C's logic.. >.>

Thanks, thats what I needed!
B
24
S
14
G
9
Posts: 118
Reputation: 6,799


Return to How do I....?

Who is online

Users browsing this forum: gamecorpstudio, Google [Bot] and 14 guests