import pygame
import sys
[Link]()
# Window setup
screen = [Link].set_mode((500, 500))
[Link].set_caption("Image Animation")
# Load image
image = [Link]("[Link]")
x, y = 50, 200 # Starting position
speed = 5
clock = [Link]()
# Game loop
while True:
for event in [Link]():
if [Link] == [Link]:
[Link]()
[Link]()
# Move image
x += speed
if x > 500 or x < 0:
speed = -speed # Bounce back
[Link]((30, 30, 30)) # Background color
[Link](image, (x, y)) # Draw image
[Link]()
[Link](30) # FPS