Swipe gestures?

1 favourites
  • 13 posts
From the Asset Store
All popular touch mechanics - scrolling, zooming, swiping
  • Just a quick question - is it possible to do Swipe gestures in Construct 3 or it it variations of Tap only?

  • yeah its possible

    here is the Manual --> https://www.scirra.com/manual/119/touch

    was smth like

  • There isn't any built-in swipe action, but you can make it manually, in a couple of minutes!

    There could be various factors you'll need to consider: e.g. is it touch and swipe, is it hold-already and swipe, how far to swipe, speed of swipe.

    How I do it is simple. The logic is:

    • On Any Touch Start: Create four invisible objects (squares)
    • Set Position for each top, bottom, left and right (e.g. Touch.X + 150, Touch.Y + 150, etc.)
    • Is Touching Right and Trigger Once: Swipe right actions/function (do this for each object)
    • On Any Touch End: Destroy all four objects

    It's quite quick and easy, plus it gives you enough control on how much to swipe (by setting a good distance between the object and Touch start).

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • You can also use Touch.AngleAt() and Touch.SpeedAt() expressions.

    For example, if Touch.SpeedAt(0)>200 and Touch.AngleAt(0) between -45 and 45 degrees, it's a swipe to the right.

  • You can also use Touch.AngleAt() and Touch.SpeedAt() expressions.

    For example, if Touch.SpeedAt(0)>200 and Touch.AngleAt(0) between -45 and 45 degrees, it's a swipe to the right.

    dop2000 - this seems a logical approach, with the other angles being between:

    Right: -45/45 degrees

    Down: 45/135 degrees

    Left: 135/225 degrees

    Up: 225/-45 degrees

    How would I begin to implement this via the stylesheets though?

    For example if I had a sprite (ball) and I wanted to swipe up to move it up, how would i do this?

  • Stylesheet? Did you mean event sheet?

    You can use "System Compare two values" condition for Touch.SpeedAt()

    and "System Is Between Angles" or "System Is Within Angle" to compare Touch.AngleAt()

    Note though, that if you want to detect swipe gestures properly, these are not enough. You also need to check that the finger is not changing direction, compare time etc.

  • Yes, Event sheet - sorry.

    Looks like this is going to massively advanced for my limited skills. No idea where to start when comparing time and direction etc.

    Where would I even begin with that?

  • Start small - with checking the speed and angle only. Maybe it will be enough for your purpose.

  • As ever I'm still flailing in the dark...

    When you say check the speed and angle - check the speed and angle of what?

  • Touch of course!

    This is swipe to the right:

    System Compare two values: Touch.SpeedAt(0)>200
    System Touch.AngleAt(0) Is Between Angles -45 and 45
    
  • OK - I've done this. Is this correct?

  • No, that's not correct.. See this demo:

    dropbox.com/s/gk6xktdvn0p9cn0/SwipeControls.c3p

  • Hey thanks for your help with this - I’m not ignoring your post, but had issues with Apple over the last few days that have taken me away from it. Hopefully I’ll be back on this in the next couple of days.

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