Hi
Andrew,
For buttons I use this:
if event.type ==
pygame.JOYBUTTONDOWN:
if event.button ==
"whatever...":
etc....
if
event.type == pygame.JOYBUTTONUP:
and so
on...
For analog control and d-pads you have to check for axis
position each time through the game loop. I do it all at once before the
player objects update themselves
Like this:
horizontal_axis =
self.joysticks[player_number].get_axis(0)
vertical_axis =
self.joysticks[player_number].get_axis(1)
Then change the x and y speed
for the player with "player_number" to whatever the axis positions are (times a
constant, if necessary). Of course, the player_number has to correspond to
the joystick collection indices pretty well for this to work. You can
eliminate that part of it by replacing "player_number" with "0" and just make
sure to check that the joystick count is >0 before you call
.get_axis
Hope this helps a little!
-Lee-
On Thu, Dec 1, 2011 at 5:51 PM, Andrew Godfroy
<killerrin@xxxxxxxxxxx>
wrote:
Alright, I just checked over my question and I noticed I wasn’t exactly
clear what I was looking for...
What I am asking is how do I work the event handler for checking
joystick commands such as if the Left Thumbstick-[0] or [1]- moves, or if the
A button-[0]- is pressed
Does anyone know how that works?