I want to make my player move his arm around in 360� following the movement on the gamepad stick.
Is there a way to use the X and Y values of the axis and turn them actively into degrees from 0 to 360?
Develop games in your browser. Powerful, performant & highly capable.
Try using an expression like this for the angle:
angle(0, 0, Gamepadbeta.Axis(0, 0), Gamepadbeta.Axis(0, 1))
thanks ashley, it works perfectly =)!
Is there a way to use the right axis for that? There seems to only be one gamepad.axis method...
menasheh: You can see in the manual article for the gamepad that the Axis(Gamepad, Index) expression expects an index value that will let it know which joystick to look for.
Likely change the second 0 to a 1 and it should read the right joystick. As mentioned, it depends on the mapping, so this is something you may have to check for before the game starts if you plan on using it.
Kyatric I'm using angle(0,0,Gamepad.Axis(0, 0), Gamepad.Axis(0, 1)) - this works to use the left axis. Notice the index value is different - the index value is not which joystick to use, its to choose between the X or Y axis.
menasheh To do the same thing for the right stick it would be angle(0,0,Gamepad.Axis(0, 2), Gamepad.Axis(0, 3))
Hello, I'm trying to make a 2 players mode using 2 gamepads. The expression angle(0, 0, Gamepadbeta.Axis(0, 0), Gamepadbeta.Axis(0, 1)) worked perfctly for the first gamepad. How can I make it work for player 2 on the second gamepad?
marcellolima you can find that info in the link posted by Kyatric
There's a paragraph for multiple gamepads in one computer. Hope that helps
marcellolima That would be: angle(0, 0, Gamepad.Axis(1, 0), Gamepad.Axis(1, 1))
This post had exactly what I have been looking for, thank you all so much for asking all the right questions, this helped me out big time!