我在 python 中使用 pygame 编写游戏,但有些图像显示不正确。如下面的截图所示,左上角的生命值条显示不好。图片是一个png文件。以前有人遇到过这个问题吗?这是我加载图像的方式:
pygame.display.set_caption("House Protection")
player = pygame.image.load("resources/images/Character1.png")
player2 = pygame.image.load("resources/images/Character2.png")
background = pygame.image.load("resources/images/Grass_BackGround.jpg")
house = pygame.image.load("resources/images/House.png")
bulletimage = pygame.image.load("resources/images/Bullet.png")
Enemyimage1 = pygame.image.load("resources/images/Zombie1.png")
Enemyimage2 = pygame.image.load("resources/images/Zombie2.png")
healthbar = pygame.image.load("resources/images/healthbar.png")
health = pygame.image.load("resources/images/health.png")
gameover = pygame.image.load("resources/images/gameover.png")
youwin = pygame.image.load("resources/images/youwin.png")