Question by
shmoneygeek999 · Feb 07, 2016 at 05:40 PM ·
playercontrollerswipeverticalleft
Swipe Control for Android , Move left and Right ( vertical )
hello world i've a problem with my game ( Ping Pong ) for Android ; the paddle of player can't Move on my smartphone , so pliiz give me the script of swipe control and thanks in advance .
Comment
It's very unlikely, that someone'll give you a whole code. Have you ever tried looking at Input.Touch or even figuring out for yourself?
Answer by iDownward_ · Jan 27, 2017 at 06:44 PM
float posY = gameObject.transform.position.y + (Input.GetAxis ("MouseY") * speed);
playerPos = new Vector2 (transform.position.x, Mathf.Clamp (posY, minimoY, maximoY));
gameObject.transform.position = playerPos;
// this code is inside the void Update()
After that, go File -> Build Settings -> Android -> Switch Platform.
You will be able to build and run your apk and swiping to move your paddle
Your answer
Follow this Question
Related Questions
Adding animation controller rescales character 0 Answers
How do I get a character to walk on walls and ceilings? 1 Answer
detect rotation direction (clockwise or counterclockwise) from touch drag gesture or swipe. 0 Answers
How to control a plant or vine? 0 Answers
optimising player controller 1 Answer