当我向上,向下,向左或向右走时,我想要在我向那个方向走的时候播放3张图像.
player = pygame.image.load('data/down1.png')
playerX = 610
playerY = 350
while 1:
clock.tick(30)
for event in pygame.event.get():
if event.type == pygame.QUIT:
return
if event.type == pygame.KEYDOWN and event.key == pygame.K_ESCAPE:
return
if event.type == pygame.KEYDOWN and event.key == pygame.K_DOWN:
player = pygame.image.load('data/down1.png')
player = pygame.image.load('data/down2.png')
player = pygame.image.load('data/down3.png')
playerY = playerY + 5
screen.fill((0, 0, 0))
screen.blit(player, (playerX, playerY))
pygame.display.flip()
Run Code Online (Sandbox Code Playgroud)
(这是我的代码btw的一部分)所以,有什么方法可以让我这样做,当我走下去时,它就像一个走下来的图像的动画?