You can use pygame.key.get_pressed to do that.
example:
while running: keys = pygame.key.get_pressed() #checking pressed keys if keys[pygame.K_UP]: y1 -= 1 if keys[pygame.K_DOWN]: y1 += 1
1.4m articles
1.4m replys
5 comments
56.9k users