Answers for "how to check your key in pygame"

7

check key pressed pygame

import pygame
events = pygame.event.get()
for event in events:
    if event.type == pygame.KEYDOWN:
        if event.key == pygame.K_LEFT:
            location -= 1
        if event.key == pygame.K_RIGHT:
            location += 1
Posted by: Guest on November-26-2020
1

how to get pygame key

# current state of all the keys (pressed, not pressed)
pygame.key.get_pressed
Posted by: Guest on September-01-2021

Code answers related to "how to check your key in pygame"

Python Answers by Framework

Browse Popular Code Answers by Language