📜  检查键按下 pygame - Python 代码示例

📅  最后修改于: 2022-03-11 14:46:32.075000             🧑  作者: Mango

代码示例1
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