Related Stack Overflow questions:
-
how to make sprite move upwards and downwards with joystick in PyGame
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")
Related Stack Overflow questions:
Related Stack Overflow questions:
Related Stack Overflow questions: