How do I make touch control to make sprite move left and right only
Did you try to use the "Custom Movement" behavior ?
You can use it to make go left or right when a key is pressed.
I wanna do it by touch control
compare your Sprite.X with Touch.X
if Touch.X < Sprite.X == move left
if Touch.X > Sprite.X == move right
Develop games in your browser. Powerful, performant & highly capable.
Use the "Custom Movement" behavior to the sprite and "On Touch objet" == Sprite , "simulate control"
Thank you for helping
I'd probably use 8 directional movement and then compare the touch.x to the object.x and if it is was not equal have it simulate movement. However in my game I made like this I believe I decided to not want it to go to the dead center of the object so I used two vents to check if it was greater then object.x+32 and a second event to check if it was less then object.x -32 or something along those lines.
there are many way to make control touch ( left and right) . thanks
Learn more with demos: