How to detect Swipe direction/angle

0 favourites
  • 5 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • Hello,

    I'm trying to use swipe control the player on touchscreen.

    The "detecting touch speed" condition is very useful, but I also want the player move to the direction same as swipe direction. anybody know how to do this?

  • One way is to create variables to store the x,y values on touch start and on touch end and calculate an angle from those.

    How you turn that into movement may depend on the behavior you have set for your player.

  • Thanks BenGIJOE. What if the swipe is a curve move? and I want the object move to the arrow direction in the picture.

    <img src="https://dl.dropbox.com/u/1396615/bugImage/Swipe.jpg" border="0" />

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • I am also looking for the same.

    Example: swipe from left to right or right to left would bring up some sprite. And swipe from top to bottom or bottom to top would bring up some sprite.

    Can anyone submit a capx?

  • Thanks BenGIJOE. What if the swipe is a curve move? and I want the object move to the arrow direction in the picture.

    you can set a maximum offset for the x an y an so set max values for example:

    Imagine a D pad, allow the finger to have a maximum miss swipe lets say that the player can follow. thus if the end point of the swipe is more then the allowed offset do either nothing or the other direction.

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