AezDropZz
Posts: 29
Joined: Tue Dec 23, 2014 2:16 pm

PS3 controller

Tue Dec 30, 2014 2:14 pm

Hello,

I can't seem to figure out why it is that, whenever I use pygame.JOYAXISMOTION and pygame.JOYBUTTONDOWN at the same time in a script, axismotion just stops working... I tried using elif instead of if, but with the same result

It is as following in the script:

Code: Select all

			
if event.type == pygame.JOYAXISMOTION:
     if event.axis == 2:
          LefRig = event.value
          UpdateMotors = 1
     elif event.axis == 3:
          ForBac = event.value
          UpdateMotors = 1
if event.type == pygame.JOYBUTTONDOWN:
     if event.button == PS3_BUTTON_TRI:
          print("Triangle pressed")

AezDropZz
Posts: 29
Joined: Tue Dec 23, 2014 2:16 pm

Re: PS3 controller

Fri Jan 02, 2015 3:15 pm

In the meantime, I found the solution myself.
For some reason, you had to put the 'if'-command for the buttons first and the 'if'-command for the joysticks second. I have no clue as to why it has to be in this order, but it solved my problem.

Return to “Advanced users”