1

Here I'm trying move which is blotted on the screen but the image moving without clearing the previous one

balloon=pygame.image.load("BALLON 1".png)
Bal_x=0
       
while true:
    for event in pygame.event.get():
        if event.type==pygame.QUIT:
            pygame.quit()
            sys.exit()
    Bal_x+=1
    screen.blit(BALLON,(Bal_x.120))
    pygame.display.update()
    clock.tick(120)

It moves like in the image

raju
  • 23
  • 1
  • 1
  • 8

1 Answers1

0

You have to clear the display with pygame.Surface.fill in every frame:

balloon=pygame.image.load("BALLON 1".png)
Bal_x=0
       
while true:
    for event in pygame.event.get():
        if event.type==pygame.QUIT:
            pygame.quit()
            sys.exit()
    Bal_x+=1

    screen.fill((0, 0, 0)) # <--- this is missing

    screen.blit(BALLON,(Bal_x.120))
    pygame.display.update()
    clock.tick(120)

The typical PyGame application loop has to:

Rabbid76
  • 202,892
  • 27
  • 131
  • 174