I have code that moves my beach ball image 1 with wrapping around the edges. When I run the code, I do not get any errors but a blank black screen appears without the ball. When I exit out of the program, the image of the ball appears for a second before closing the program.
import pygame, sys
pygame.init()
screen=pygame.display.set_mode([640,640])
screen.fill([0, 0, 0])
my_ball = pygame.image.load("ball.png")
x=0
y=0
x_speed=5
running=True
while running:
for event in pygame.event.get():
if event.type==pygame.QUIT:
running=False
pygame.time.delay(20)
pygame.draw.rect(screen, [0,0,0], [x, y, 0, 0], 0)
x=x+x_speed
if x>screen.get_width():
x=0
screen.blit(my_ball,[x, y])
pygame.display.flip()
pygame.quit()