I am currently working on a circular billiards program using Turtle. My problem is that I can't figure out what angle or position I need to give Python once the ball has reached the sides of the circle in order to make it bounce. Here is the part of my program that needs to be fixed:
while nbrebonds>=0:
forward(1)
if (distance(0,y)>rayon): #rayon means radius
print(distance(0,y))
left(2*angleinitial) #I put this angle as a test but it doesn't work
forward(1)
nbrebonds+=(-1)
From what I was able to understand about this issue, you should be able to calculate what you need using turtle's
heading()
andtowards()
methods: