How do I Swipe

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

    I'm searching for a lot of time how to control a character with a swipe touch.

    Not only in 8 direction, but exactly as I swipe, or split the screen into two sides, horizontal and vertical.

    Is there a tutorial for this, I prefer video.

    Thanks,

    Idan

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • If it's sufficient for you to move your character as soon as the swipe ends (the user lifts his finger), you use this solution:

    • add the "Touch" object (obviously)
    • add two global variables "InitialX", "InitialY","CurrentX", "CurrentY" and "TouchAngle", all numbers
    • add an event "On touch start" with the following actions in it:

    --> Set InitialX to Touch.AbsoluteX (or .X, if that suits your project better)

    --> Set InitialY to Touch.AbsoluteY (or .Y)

    • add a condition "Is touching" with the following actions in it:

    --> Set CurrentX to Touch.AbsoluteX (or .X)

    --> Set CurrentY to Touch.AbsoluteY (or .Y)

    • add an event "On touch end" with the following actions in it:

    --> Set TouchAngle to "angle(InitialX,InitialY,CurrentX,CurrentY)"

    Now the swipe direction is stored in the TouchAngle variable.

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