This is due within a few hours, and I am unable to spot what is causing the program to not work.
["""Bounce - is a game that has a ball which increases in speed when you click
on the ball. That click signals the ball to speed up, records the click as a
win for the player. Once the player has reached the maximum speed, they have
the choice to restart or finish. The ball will never leave the screen but it
has a random pattern so when you lose and start over; one can not tell where
the ball will begin at."""
from math import *
from graphics import *
win = GraphWin("Bounce", 500, 500)
win.setCoords(0.0, 0.0, 500, 500)
from graphics import *
def __init__ (self, circle):#construtor
self.circle = circle
self.wins = 0
self.speed = 2
#Ball, creates the ball for the game- has its shape, path and speed
#draw ball, red ball, starts near upper window? or random
#Print game title near top
#self.circle = Circle(Point (random.randint(0,400), random.randint(0,400)), 25)#may change
#to smaller for challenge, or adjustable size
#needs move function
for i in range(100):
self.circle.move(random.randint(-100,150),random.randint(-100,175))#the move needs
#to be inside the window, make sure the numbers are different
#the move moves in one direction!
# if self.circle.getCenter().getX() > 500:
#elif self.circle.getCenter().getY() < 500:
# elif self.circle.getCenter().getX() < 0:
#elif self.circle.getCenter().getY() > 0:
# self.circle.move(0, 200)
time.sleep(self.speed)# go back over the sides after everything else
#the speed is going to be added to over time after certain event
#can I get it to move in other directions
#goes off screen, due to random; but since its random I can't predict it coming back on
#use if statements to keep on screen.
#allows the user to click the ball and increase the speed due to click.
p = win.getMouse()
X1 = self.circle.getCenter().getX()
Y1 = self.circle.getCenter().getY()
X2 = p.getX()
Y2 = p.getY()
D = sqrt(((X2-X1)**2)+((Y2-Y1)**2))#distance formula from center to click
r = self.circle.getRadius()
if D <= r:
#wins, records the amount of wins one gets whenever the ball is clicked.
self.wins = self.wins + 1
self.speed = self.speed *.01
winner = str(self.wins) + str(self.speed) + "Winner"
b = Bounce(Circle(Point (random.randint(0,400),random.randint(0,400)), 25))