Can constant key input move a sprite constantly?
If I want to move a sprite based on key input in pygame, is there anyway to write code so if I hold down a key, the sprite will keep moving in that direction until I release the key? I've tried this and either the program crashes or I have to repeatedly tap the keys to move the sprite in the intended direction. The OP wants keystate polling, not KEYDOWN events. This example shows using both key events, and key polling. You use one for 'on key press' and the other for 'while held down'. import pygame from pygame.locals import * done = False player.pos = Rect(0,0,10,10) while not done: for event