joystick motion python script

Hi everyone! My question is:

How to do the same thing as:

keyboard = bge.logic.keyboard

if bge.logic.KX_INPUT_ACTIVE == [] … then…

with my joypad(s)?

I don’t speak english very well. Thank you very much for your answers!!!

joystick = bge.logic.joysticks[0]

Note how the joystick is indexed “[0]” this allows for multiple joysticks.

To get buttons use:

if 1 in joystick.activeButtons:

Now just replace 1 with whatever button you want. If you are unsure of what number the buttons are:


And press buttons.

To get axis values:


All this and more in the API

Thank you very much!!