How do I swipe horizontally/vertically?

0 favourites
  • 3 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • Hi friends. It's been a while, but I'm here again.

    I'm making a new project. This time for mobile. And I'd like to end this project, possibly.

    Since it's meant for mobile, I'm trying to include the touch controls.

    While I'm ok with the choices selected by Construct, and I love making buttons to be pressed, I noticed I haven't found much about swiping.

    In my game, the character can change in 4 direction: Left, Right, Up and Down.

    So, if the player wants to go up, they should swipe vertically from botton to the top. Or, if the player wants to go to the left, they swipes horizontally from right to the left.

    I'm not the best in coding and all, but logically, I imagine it has to do with the orientation of the swipe. Something like "Compare touch speed" and "compare touch orientation".

    All the tutorials I've found are old or extremely long, like if such feature is not that possible.

    If it's not too much to ask, do you know how I can solve this task?

    Thank you for reading and your help, have a good day!

    Tagged:

  • "Compare touch speed" and "compare touch orientation".

    This is possible with expressions - Touch.SpeedAt(0) and Touch.AngleAt(0)

    This should be enough for simple swipe gesture recognition, but you might also want to compare touch start and end time - to check that it was a short gesture.

    dropbox.com/s/gk6xktdvn0p9cn0/SwipeControls.c3p

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • > "Compare touch speed" and "compare touch orientation".

    This is possible with expressions - Touch.SpeedAt(0) and Touch.AngleAt(0)

    This should be enough for simple swipe gesture recognition, but you might also want to compare touch start and end time - to check that it was a short gesture.

    https://www.dropbox.com/s/gk6xktdvn0p9cn0/SwipeControls.c3p?dl=0

    You are a life saver as usual!

    Yes, I've also made sure that triggers only once, else for the game it's like if I'm swiping forever ahah.

    Thank you a lot.

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