How do I manage touch event with swipe event ?

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

    I try to manage horizontal movement and shooting in my game without using any buttons. I move the sprite correctly with touch event and to shoot I put a vertical swipe. It works pretty well but I have a conflict between them triggers.

    When I swipe it also detects the touch event to move my sprite and I would like to block that. When you swipe the sprite shouldn't move. Is it possible ?

    Thank you for your answers.


  • If you are using "On touch start" event to start moving, in this event it's not possible to predict if it's going to be a short touch or a swipe. So you need to wait several ticks after the touch started, to check if the finger has moved, before moving the character.

    However, if you are using the left side of the screen for touch-to-move, and the right side of the screen for swipe-to-shoot, then you can detect and process both touches separately and even shoot while moving.

  • Thanks for your explanations dop2000

    I put the code for my motion system yesterday but apparently it didn't work. I put it back here so you can see how I do it.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Do you use the same finger to move and to attack?

  • In the idea, I use the left thumb and right thumb to move the sprite to the left or to the right and with the right or left thumb by swiping up I shoot.

  • In this case you need to check which side of the screen is touched. If the left side is in touch, you can move the character. If the right side is touched, you can detect the swipe using your method or expressions Touch.SpeedAt, Touch.AngleAt

    But if you both sides of the screen can be in touch at the same time, you need to loop through all active touches. I have something similar in this demo, take a look:

  • Thank you, actually I am not used to using Touch.SpeedAt, Touch.AngleAt and the demo you gave me should help me;) Besides, the site is Great ! I didn't know him, thanks again;)

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