- Home /
Design question
How to use Input.GetAxis in Touch Screen to make 2D Controller
Hello all,
Currently I'm trying to get a little 2d game going however I want to stay away from an on screen touch pad / button if possible.
What I would like to achieve is the same kind of control as in the standard 2d side scroller however I want to do this with the touch commands.
Now I kind of figured out how to move left and right with Input.GetTouch, and Input.TouchCount however what is tripping me up is the jumping. I would like it so when the player presses&holds on the screen the character in the game runs in that direction. Since its a 2D game this will either be left or right(X axis) However when the player taps the screen I would like the character to jump.
I can't seem to get this to work and I'm not sure where to start as the I don't know how the game would differentiate between when the player is taping/holding on the screen to run in a direction and when it will be a jump as it would see the original tap to move the character.
I thought about just having the player hold down on the screen and scroll in the up direction(Till it hits the Y Axis) to get the character to jump but I don't know if that would really work either.
If this is a limitation of touch abilities just let me know and I'll start looking into a on screen game pad system. If someone can however think of a way to get this to work or point me in the right direction that would be great.
Many thanks,
We ask that design problems be posted to Unity Forums. Unity Answers is designed to answer single, specific technical questions.
There may be an issue of usability, but you have a universe of gestures to use. Two finger taps, double taps, swipes, pinches, drags, stationary holds, etc.
Follow this Question
Related Questions
Multiple Cars not working 1 Answer
GUI cale and position according to the actual screen resolution. 1 Answer
Raycast Destroys player. 1 Answer
GUI.HorizontalSlider not working 2 Answers
How To Make GUI Buttons Load/Quit 1 Answer