精灵的照片没有导入,这个错误让我很困惑
所以,我无法识别错误是什么以及如何解决它。这是我的代码:import pygamepygame.init()win = pygame.display.set_mode((500,480))pygame.display.set_caption("First Game")walkRight = [pygame.image.load('R1.png'), pygame.image.load('R2.png'), pygame.image.load('R3.png'), pygame.image.load('R4.png'), pygame.image.load('R5.png'), pygame.image.load('R6.png'), pygame.image.load('R7.png'), pygame.image.load('R8.png'), pygame.image.load('R9.png')]walkLeft = [pygame.image.load('L1.png'), pygame.image.load('L2.png'), pygame.image.load('L3.png'), pygame.image.load('L4.png'), pygame.image.load('L5.png'), pygame.image.load('L6.png'), pygame.image.load('L7.png'), pygame.image.load('L8.png'), pygame.image.load('L9.png')]bg = pygame.image.load('bg.jpg')char = pygame.image.load('standing.png')x = 50y = 400width = 40height = 60vel = 5clock = pygame.time.Clock()isJump = FalsejumpCount = 10left = Falseright = FalsewalkCount = 0def redrawGameWindow(): global walkCount win.blit(bg, (0,0)) if walkCount + 1 >= 27: walkCount = 0 if left: win.blit(walkLeft[walkCount//3], (x,y)) walkCount += 1 elif right: win.blit(walkRight[walkCount//3], (x,y)) walkCount += 1 else: win.blit(char, (x, y)) walkCount = 0 pygame.display.update() run = Truewhile run: clock.tick(27) for event in pygame.event.get(): if event.type == pygame.QUIT: run = False keys = pygame.key.get_pressed() if keys[pygame.K_LEFT] and x > vel: x -= vel left = True right = False elif keys[pygame.K_RIGHT] and x < 500 - vel - width: x += vel left = False right = True 此代码应该导入多个图像。角色也应该移动,但移动很好。问题在于导入图像。背景也有同样的问题。压痕也很好。我不知道如何解决这个错误。错误如下:我检查了文件名称是否有问题,但我找不到其中的错误!请在这件事上给予我帮助。
查看完整描述