Hi
Im trying to implement a joystick in my game (2D movement). Now, the left/right movement is easy enough, using the supplied standard code of:
if (moveTouchPad.position == 1 ) {
movement = Vector3.right * forwardSpeed * moveTouchPad.position.x; }
else{
movement = Vector3.right * forwardSpeed * moveTouchPad.position.x;
}
But what I’m stuck on is how to include movement for up and down, where I want my player to move up and down the y axis to predetermined positions (e.g. transform.position.y = 20).
I tried a switch statement of sorts, but failed… how else can I do this?
Thanks!