Double tap and tap events on the sprite

0 favourites
From the Asset Store
Very simple code without excess options (15 events for server and 11 events for client)
  • Hi guys, could you tell me, please:

    I want a sprite to react on "tap" and "double tap" events, but "tap" always overwrites "double tap", so "double tap" event handler never run, regardless of the order or the arranging "tap" and "double tap" events.

    How can I react on "tap" and "double tap" on the same object?

    Sincerely yours,

    ANdy

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • AndyRevenko I always use custom touch code rather than the helpers. Try using just tap events and check the time between taps to use as a double tap.

  • AndyRevenko I always use custom touch code rather than the helpers. Try using just tap events and check the time between taps to use as a double tap.

    THnaks, gameglaux!

    But it will not solve the problem - the "tap" will always runs anyway, so I can have either "tap" or "double tap" events, but not the both

  • Tap and double tap can be used on the same sprite.

    Use tap or double tap to set a trigger using a global variable.

  • AndyRevenko since you want the object to react to a tap AND a double tap... the single tap event must run, unless the object waits to see if a double tap registers within a time limit then decide what code to run.

    May use a swipe for the extra action, or a long press if the extra action is not immediate?

  • Tap and double tap can be used on the same sprite.

    Use tap or double tap to set a trigger using a global variable.

    The OP is already using this. The problem is the tap gesture always runs

  • > Tap and double tap can be used on the same sprite.

    >

    >

    >

    > Use tap or double tap to set a trigger using a global variable.

    >

    The OP is already using this. The problem is the tap gesture always runs

    If it always runs it is because he is not using the trigger variable properly.

    If he wants to post an image of his events or a CAPX I will gladly look at why his tap event is always running.

  • If it always runs it is because he is not using the trigger variable properly.

    If he wants to post an image of his events or a CAPX I will gladly look at why his tap event is always running.

    Unless ive not had enough coffee this morning, it doesnt matter. If you put a tap and a double tap trigger on an object, the tap will always run.

  • In my opinion, the double tap is not needed.

    https://www.dropbox.com/s/69fwfrp1a70my ... .capx?dl=0

    If it has to be a double tap, i would do it this way.

    https://www.dropbox.com/s/9jncoe36clun8 ... .capx?dl=0

  • >

    > If it always runs it is because he is not using the trigger variable properly.

    >

    > If he wants to post an image of his events or a CAPX I will gladly look at why his tap event is always running.

    >

    Unless ive not had enough coffee this morning, it doesnt matter. If you put a tap and a double tap trigger on an object, the tap will always run.

    No and there is my events using the same sprite with tap and double tap. It sets the variable to 1 on tap and 0 on double tap.

    If you have a sprite with animations it will run one animation when variable is 1 and another when it is 0 and can be used for many other triggers.

  • >

    > If it always runs it is because he is not using the trigger variable properly.

    >

    > If he wants to post an image of his events or a CAPX I will gladly look at why his tap event is always running.

    >

    Unless ive not had enough coffee this morning, it doesnt matter. If you put a tap and a double tap trigger on an object, the tap will always run.

    You are absolutely right I've verified it in visual studio - the same situation, "double tap" is always ignored if "tap" is also presented.

    I see now, this is phisically is not possible to have the both events. The "wait" action in "tap" in order to distinguish "just tap" from "double tap" will make user crazy (me too, by the way

  • Well there is the capx showing it done:

    https://www.dropbox.com/s/5l65bwdugjuby27/Tap%20Example.capx?dl=0

    There are the events:

    Works like a charm guys!

    I'd say you need more coffee.

  • No and there is my events using the same sprite with tap and double tap. It sets the variable to 1 on tap and 0 on double tap.

    Setting the variable is an action, not an event. The tap event runs every touch on that object. Double tap or single tap.

  • Sorry for trowing something in your coffee.

    When pause = off ... A double tap will switch it on .. then off (after a short time).

    Clearly showing that the 'on tap' runs its actions, even when double tapped.

    The easy solution is in my example.

  • > No and there is my events using the same sprite with tap and double tap. It sets the variable to 1 on tap and 0 on double tap.

    >

    >

    Setting the variable is an action, not an event. The tap event runs every touch on that object. Double tap or single tap.

    That is why you use the variable to trigger the event!

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