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

  • 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..)

  • 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

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • 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

  • Thanks for the answers,

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

    Thanks, thats what I needed!

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