Answers for "how to make objects move using wasd controls in pygame"

0

how to make objects move using wasd controls in pygame

running = True
while running:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            pygame.quit(); sys.exit()
            running = False

        if event.type == pygame.KEYDOWN:
            if event.key == pygame.K_LEFT:
                print('left')
            if event.key == pygame.K_RIGHT:
                print('right')
            if event.key == pygame.K_UP:
            	print('up')
            if event.key == pygame.K_DOWN:
              print('down')
Posted by: Guest on July-09-2021

Code answers related to "how to make objects move using wasd controls in pygame"

Python Answers by Framework

Browse Popular Code Answers by Language