Pygame single push event
- by Miller92Time
in Pygame i am trying to translate an image by 10% in each direction using each arrow key. right now the code i am using moves the image as long as the key is pushed down, what I want is for it to move only once regardless if the key is still pushed down or not.
if event.type == KEYDOWN:
if (event.key == K_RIGHT):
DISPLAYSURF.fill((255,255,255)) #Clears the screen
translation_x(100)
draw(1)
if (event.key == K_LEFT):
DISPLAYSURF.fill((255,255,255)) #Clears the screen
translation_x(-100)
draw(2)
if (event.key == K_UP):
DISPLAYSURF.fill((255,255,255)) #Clears the screen
translation_y(100)
draw(3)
if (event.key == K_DOWN):
DISPLAYSURF.fill((255,255,255)) #Clears the screen
translation_y(-100)
draw(4)
is there a simpler way of implementing this besides using time.sleep