Hi everybody !
I’m doing a 2D on android and i want to use a joystick to move my player in 4 direction.
but whith my code, my player can move to 8 direction
So i want to know if i can lock the diagonal direction?
Here my code
if (CrossPlatformInputManager.GetAxis("Horizontal") > 0.5)
{
// vector2 move code right
}
if (CrossPlatformInputManager.GetAxis("Horizontal") < -0.5)
{
// vector2 move code left
}
if (CrossPlatformInputManager.GetAxis("Vertical") < -0.5)
{
// vector2 move code down
}
if (CrossPlatformInputManager.GetAxis("Vertical") > 0.5)
{
// vector2 move code up
}
Thanks for reading me !
Have a good day !