Program 1: A ball moves a fixed number of times.

The task is to move the circle representing a ball 50 times using a repeat-loop.


Program 1

The statements inside the repeat loop will be executed 50 times. Every 0.025 secs, the x-position of the circle changes by 5 (it increases by 5) and the circle turns clockwise by 10 degrees. The two changes result in the circle moving horizontally to the right in a rolling motion.

The code shows the ball rolling in a smooth and realistic way.  It is a good experience to let students try out other values controlling the movement.  Some will not correspond to a realistic movement. The laws of physics determine the right changes based on the size of the circle. Video Length: 3:29