Skip to content

Latest commit

 

History

History
62 lines (42 loc) · 2.99 KB

pygame_joystick.md

File metadata and controls

62 lines (42 loc) · 2.99 KB

StackOverflow            reply.it reply.it


Joystick

Related Stack Overflow questions:

joystick = None
run  = True
while run:

    move = [0, 0]
    if joystick:
        axis_x, axis_y = (joystick.get_axis(0), joystick.get_axis(1))
        if abs(axis_x) > 0.1:
            move[0] = speed * axis_x
        if abs(axis_y) > 0.1:
            move[1] = speed * axis_y
    else:
        if pygame.joystick.get_count() > 0:
            joystick = pygame.joystick.Joystick(0)
            joystick.init()
            print("joystick initialized")

USB joystick

Related Stack Overflow questions:

Gamepad issues

Related Stack Overflow questions:

Xbox issues

Related Stack Overflow questions:

📁 Joystick test tool`