First, make a text actor and call him"TEST". Then, go to draw actor and put this code in:
- Code: Select all
float ls_XAxis = GetJoystick1Axis(0);
textNumber = ls_XAxis;
This will reveal the max X speed you can go with the joystick. My max results were "32768", so I open up the calculator, and type in that number, "32768" then I devide it by how much velocity I want. For example, if I want an xvelocity of "5", I'd divide it by 5.
The results:
32768 / 5 = 6553.6
So now, go to the player you want to have moving with the joystick, and put this code in (After you already put the Xaxis and Yaxis scripts in, find them here)
Use this code in the draw actor of the player or what ever actor your trying to move with the joystick
- Code: Select all
xvelocity = ls_XAxis / 6553.6
And now your player will always be moving at an xvelocity of 5
You must do the same with the yspeed