Double tap and tap events on the sprite

Discussion and feedback on Construct 2

Post » Tue Feb 14, 2017 10:09 am

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
B
9
S
2
Posts: 34
Reputation: 603

Post » Tue Feb 14, 2017 10:38 am

@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.
Image
B
30
S
9
G
3
Posts: 171
Reputation: 3,329

Post » Tue Feb 14, 2017 11:33 am

gameglaux wrote:@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
B
9
S
2
Posts: 34
Reputation: 603

Post » Tue Feb 14, 2017 11:46 am

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



Image

Use tap or double tap to set a trigger using a global variable.
Banned User
B
27
S
7
G
58
Posts: 1,229
Reputation: 34,790

Post » Tue Feb 14, 2017 11:49 am

@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?
Image
B
30
S
9
G
3
Posts: 171
Reputation: 3,329

Post » Tue Feb 14, 2017 11:57 am

lamar wrote:Tap and double tap can be used on the same sprite.



Image

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 :)
Image
B
30
S
9
G
3
Posts: 171
Reputation: 3,329

Post » Tue Feb 14, 2017 12:06 pm

gameglaux wrote:
lamar wrote:Tap and double tap can be used on the same sprite.



Image

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.
Banned User
B
27
S
7
G
58
Posts: 1,229
Reputation: 34,790

Post » Tue Feb 14, 2017 12:12 pm

lamar wrote: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.
Image
B
30
S
9
G
3
Posts: 171
Reputation: 3,329

Post » Tue Feb 14, 2017 12:14 pm

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
B
33
S
18
G
28
Posts: 2,493
Reputation: 20,950

Post » Tue Feb 14, 2017 12:15 pm

gameglaux wrote:
lamar wrote: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.
Banned User
B
27
S
7
G
58
Posts: 1,229
Reputation: 34,790

Next

Return to Construct 2 General

Who is online

Users browsing this forum: mihirolover, Tjums, Yahoo [Bot] and 14 guests