How do I make it so that when I press down the 'A' key for example, it keeps moving me x amount of pixels to the left as long as the 'A' button is pressed down, instead of just moving me the x amount 1 time and then waiting for me to press the button down again and again to move more?
player_pos = [WIDTH/2, 760]
player_move = 15
holdkeys = pygame.key.get_pressed()
if holdkeys[pygame.K_a]:
player_pos[0] -= player_move
elif holdkeys[pygame.K_d]:
player_pos[0] += player_move
if holdkeys[pygame.K_w]:
player_pos[1] -= player_move
elif holdkeys[pygame.K_s]:
player_pos[1] += player_move
if event.key == pygame.K_e:
text_pos = text_offscreen
elif event.key == pygame.K_r:
text_pos = text_onscreen
WIDTH is just the width of my game screen.