Pygame.key.get_pressed - how to add interval?
问题 I have made a simple grid and a simple sprite which works as "player". but when i use arrow keys to move, the character moves too fast as shown in the picture below: and my question is: How do I set delay or Interval after each keypress event to prevent this problem? player.py #!/usr/bin/python import os, sys, pygame, random from os import path from pt import WIDTH,HEIGHT from pygame.locals import * img_dir = path.join(path.dirname(__file__), 'img') class Player(pygame.sprite.Sprite): def _