You have to
blit the background before drawing the scene, and you have to draw it in your game loop. When you draw a background, it covers everything that was previously drawn:
- Draw background
- Draw scene (all the objects)
- Update display
Note that there is no need to clear the background when you draw a background image. If the background image covers the entire window, there is no need to clear the background.
while running: # [...] while 1: for e in pygame.event.get(): if e.type == QUIT: pygame.quit() exit(0) # [...] # draw background # screen.fill(0) <--- superfluous screen.blit(BACKGROUND_FASE, (0, 0)) # draw scene (objects) for i in range(len(images)): screen.blit(images[i], img_rects[i]) # update display pygame.display.flip()
CLICK HERE to find out more related problems solutions.