I was working on a pong game using python turtle. The ball that I am using python turtle is moving at random speeds. Sometimes it is too slow and sometimes it accelerates. I have no clue what is going on. This is the code that I have written for the pong ball -
ball = turtle.Turtle()
ball.speed(0)
ball.shape("square")
ball.color("white")
ball.penup()
ball.dx = 0.1
ball.dy = 0.1
while True:
window.update()
ball.setx(ball.xcor() + ball.dx)
ball.sety(ball.ycor() + ball.dy)
I tried changing the dx and dy to a certain number to alter the speed but the ball rarely follows the command and is going too slow or fast.