我在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")