background = "">
background.fill((0, 0, 0))
box = pygame.Surface((20, 20))
box = box.convert()
box.fill((255, 0, 0))
box_x = 0 #box variable for the x-axis
box_y = 0 #" " y-axis
clock = pygame.time.Clock()
keepGoing = True
while keepGoing:
clock.tick(30)
for event in pygame.event.get():
if event.type == pygame.QUIT:
keepGoing = False
box_x += 5
box_y += 5
if box_y > screen.get_height(): #checking for screen boundaries
box_y = 0
if box_x > screen.get_width():
box_x = 0
screen.blit(background, (0, 0))
screen.blit(box, (box_x, box_y))
pygame.display.flip()
pygame.quit()