1

I have a piece of code where I need to detect if a key has been pressed; here is my code:

if pygame.KEYDOWN and pygame.K_LEFT:
    x -= 1

if pygame.KEYDOWN and pygame.K_RIGHT:
    x += 1

I don't know what the problem is, but even if I don't press any keys at all, it still runs the code x -= 1 and x += 1 I can't find anyone online that can help me. So anyways, If you can help, then please help, and thanks in advance.

D_00
  • 1,440
  • 2
  • 13
  • 32
Duck Duck
  • 159
  • 6

0 Answers0