Touch tap x swipe

Hello Gamesalad developers

I have an actor I would like to respond to both swipe and tap (touchscreen).

I was unable to find a nice solution in the forums, but I guess someone already solved it.

Thanks in advance

Comments

  • SocksSocks London, UK.Member Posts: 12,822
    edited June 2015

    I suppose you could take a measurement when touch is pressed - and then take measurement a fraction of a second later . . . . if the distance the touch position has moved is more than 5 pixels (or whatever) then register as a swipe, if less than 5 pixels then it's a tap.

    Does that make sense ?

    So . . .

    When moose button is down . . .
    --Change game.FirstTouch X to moose X
    --Change game.FirstTouch Y to moose Y
    --Timer: After 0.02 seconds
    ----Rule: if magnitude of (moose X - FirstTouch X, moose Y - FirstTouch Y) < 5
    ------Do your touch actions
    ----Otherwise
    ------Do your swipe actions

  • SocksSocks London, UK.Member Posts: 12,822
    edited June 2015

    Here's a quick demo, I'm sure you could refine it a lot, click or swipe from the red box . . .

    (file attached).

  • SocksSocks London, UK.Member Posts: 12,822

    Yes 'moose'.

  • egorgesegorges Member Posts: 21

    @Socks said:

    When moose button is down . . .
    --Change game.FirstTouch X to moose X
    --Change game.FirstTouch Y to moose Y
    --Timer: After 0.02 seconds
    ----Rule: if magnitude of (moose X - FirstTouch X, moose Y - FirstTouch Y) < 5
    ------Do your touch actions
    ----Otherwise
    ------Do your swipe actions

    Thank you for simplifying the solution and wonderful sample!

    I'll play a little bit with the timer so not to have both tap and swipe in case of a slow swipe.
    Best regards

  • SocksSocks London, UK.Member Posts: 12,822

    @egorges said:
    I'll play a little bit with the timer so not to have both tap and swipe in case of a slow swipe

    Yeah, I'm sure you can refine it a lot, playing with the timer will be the most obvious first call, but I'm sure there are other tricks to be found (for example the overwhelming majority of swipes will be left to right (for right-handed people) the rest right to left.

Sign In or Register to comment.