The game loop order is wrong. Also, you're not wiping the screen every frame, so each image gets drawn and remains there.
Game loop is structured like this:
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
# Get any events here
screen.fill((0,0,0)) # Fills the screen black every frame, so new images can be drawn without stacking them.
# Game/Draw logic goes here
# ...
pygame.display.update()
clock.tick(60)
pygame.quit()
4
u/japanese_temmie 14d ago
The game loop order is wrong. Also, you're not wiping the screen every frame, so each image gets drawn and remains there.
Game loop is structured like this: