Answers for "simple input button in pygame"

2

input in pygame

def getInput():
    ''
    for event in pygame.event.get():
            
            if event.type == pygame.KEYDOWN:
                print("event" + str(event))
                if event.key == pygame.K_ESCAPE:
                    playing = False
                elif event.key == pygame.K_w:
                    input = input + "w"
                elif event.key == pygame.K_s:
                    input = input + "s"
                if event.key == pygame.K_a:
                    input = input + "a"
Posted by: Guest on August-06-2021

Python Answers by Framework

Browse Popular Code Answers by Language