#Trisha Ruiz
#6/13/2023
#dvd movement

#initializations
import pygame, sys
from pygame.locals import *
pygame.init()

#CONSTANTS
WINDOW_WIDTH = 1000
WINDOW_HEIGHT = 700
width = 100
height = 80

#window settings
DISPLAYSURF = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_HEIGHT))
pygame.display.set_caption("Bouncing Ball")

clock = pygame.time.Clock()
#center
x = WINDOW_WIDTH / 2
y = WINDOW_HEIGHT /2

#difference in x y
dx = 1
dy = 1

#LOAD IMAGES, image file: dvd.png must be inside same directory as your working file
dvd = pygame.image.load("dvd.png")
dvd = pygame.transform.scale(dvd, (width, height))

while True:

    for event in pygame.event.get():
        if event.type == QUIT:
            pygame.quit()
            sys.exit()

    #in order for our shapes to move were going to fill our window constantly
    DISPLAYSURF.fill("black")

    #ball movement
    x += dx
    y += dy

    if x >= WINDOW_WIDTH-width or x <= 0:
        x -= dx
        dx = -dx
    if y >= WINDOW_HEIGHT-height or y <= 0:
        y -= dy
        dy = -dy
        
    #replaces drawing our ball
    DISPLAYSURF.blit(dvd, (x, y))
    
    #set game framerate
    clock.tick(200)
    
    #always just need this to display everything
    pygame.display.update()

    

