Pygame.image.load不工作?

时间:2017-04-09 05:36:43

标签: python pygame pyglet

我是Pygame的初学者,正在按照本教程在Pygame中构建一个简单的Minecraft游戏。我正在学习本教程 <{3}},pygame.image.load()将不会显示。

这是我的代码(主要部分):

#Game Dimensions
TILESIZE = 20
MAPWIDTH = 30
MAPHEIGHT = 20

#Player and position
PLAYER = pygame.image.load('Player.png')
playerPos = [0, 0]

while True:
#User Events
for event in pygame.event.get():
    #If they want to quit
    if event.type == QUIT:
        pygame.quit()
        sys.exit()
    elif event.type == K_RIGHT:
        if (event.key == K_RIGHT):
            playerPos[0] += 1

#Everything between here and

#Display the player
DISPLAYSURF.blit(PLAYER, (playerPos[0]*TILESIZE, playerPos[1]*TILESIZE))

for row in range(MAPHEIGHT):
    for column in range(MAPWIDTH):
        DISPLAYSURF.blit(textures[tilemap[row][column]], (column*TILESIZE, row*TILESIZE))

#Here
#Updates screen
pygame.display.update()

Player.png是20px乘20px

的圆圈图像

感谢您的帮助(:

1 个答案:

答案 0 :(得分:1)

绘制图块后绘制播放器。它可能会被覆盖。