Move the player with finger

Hi. I want to do a pong. I want to move the player with the finger (not using arrastable). How I can do that?

Buenas. Estoy haciendo un pong y quiero que el movimiento sea con el dedo (para jugar en móvil) sin usar arrastable. Como lo puedo hacer?

As in draggable the behaviour?


I’m assuming you’re making a 2 player pong, with the ball going left and right, like the 70’s original game.

You’ll need to use multi touch. Keep track of which half of the screen the touch was made to determine which paddle should be moved and whether a touch is already in action for that half.

If the touch is valid, keep track of the touch id, the initial position and the player’s paddle’s position. As the touch moves, get the Y difference between the original touch position and the current touch position, and subtract this value from your original paddle position.