One-dimensional Joystick for Mobile

Hello,

I am currently struggling with making a joystick that only goes left and right. I’m meant to hold down anywhere on the screen and move my finger left to make the player go left and right to make it go right. I find tons of tutorials online on how to code a 2D joystick but that just makes things way too complicated for what I need. How should I proceed?

Thank you in advance!

You could probably hack my VAButton.cs code to do that. It’s a relative analog joystick and part of my ProximityButtons package.

proximity_buttons is presently hosted at these locations:

https://bitbucket.org/kurtdekker/proximity_buttons

https://github.com/kurtdekker/proximity_buttons

If you clone/copy it then you can make your own flavor that limits vertical deflection, or else you can use it as-is and just always set the y offset to zero before using it, or only pay attention to the x offset. Your choice!

1 Like