# Maria Mauco
# 6/12/2024

# Initialize pygame
import random
import pygame, sys
from pygame.locals import *
pygame.init()

# Variables

clock = pygame.time.Clock()

DISPLAYSURF = pygame.display.set_mode((1000,600))
pygame.display.set_caption('Wrapping ball')
#colors
white = pygame.Color(255,255,255)
purple = pygame.Color(200,10,250)
# circle variables
xC = 100
yC = 600/2
radius = 50

dx = 1
dy = 1


# Game loop
while True:
    
    clock.tick(200) # fps

    # event
    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()
    
    #fill screen
    DISPLAYSURF.fill('black')
    
    # wrap ball
    if (xC > 1000 + radius):
        xC = 0 - radius
    # wrap ball
    if (yC > 600 + radius):
        yC = 0 - radius

    # draw ball
    pygame.draw.circle(DISPLAYSURF, purple, (xC,yC), radius)

    xC += dx
    yC += dy

    pygame.display.update()
