I am trying to get my circle object to go up once it hits the bar object. I have a function for it, but once the ball hits the bar object it just shakes back and forth on the bar
20 is the radius of the circle object.
I have a class for the circle and the .getYVal() returns the Y value of the centerPoint
The .getY() for the bar is in the bar class and returns the top left y value.
This is what I have for the function so far:
def checkBallAndBar(ball1, bar):
if ball1.getYVal() + 20 > bar.getY():
ball1.moveUp()
else:
ball1.moveDown()
Does anyone have any suggestions?