0

I am writing game by using pygame in python, but some of the images are not displaying correctly. As is shown in the screenshot below, the health bar shown on the top left is not displaying well. The picture is a png file. Has any one had this issue before? Here is the way I am loading images:

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

enter image description here

J.Clarke
  • 392
  • 2
  • 15
Wang Nick
  • 385
  • 1
  • 6
  • 17
  • Could you try using `convert` after loading the image, like `healthbar = pygame.image.load("resources/images/healthbar.png").convert()`? – sloth Oct 15 '15 at 08:35
  • 1
    please post the rest of the code too (the part where the bars are rendered) – xXliolauXx Oct 15 '15 at 10:45
  • it is probably either how you are rendering it or the image itself. But there is not enough here to answer. – cmd Oct 15 '15 at 15:29

0 Answers0