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
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