Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while True:
- pygame.key.set_repeat(500,30)
- pygame.key.get_repeat()
- for event in pygame.event.get():
- # Controls
- if event.type == QUIT:
- terminate()
- elif event.type == KEYDOWN:
- if (event.key == K_LEFT or event.key == K_a) and direction != RIGHT:
- direction = LEFT
- elif (event.key == K_RIGHT or event.key == K_d) and direction != LEFT:
- direction = RIGHT
- elif (event.key == K_UP or event.key == K_w) and direction != DOWN:
- direction = UP
- elif (event.key == K_DOWN or event.key == K_s) and direction != UP:
- direction = DOWN
- elif event.key == K_ESCAPE:
- terminate()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement