Subprograms

A Simple Comet

The purpose of this exercise is to animate the planets using subprograms.

_images/05_1.png

Expected result

Question 1

Implement Compute_X and Compute_Y functions and use them in the main loop to update X and Y coordinates of every object.

Question 2

Implement the Move subprogram and use it to move the objects instead of doing all computations in the main loop.

Move should also update the angle.

Question 3

Implement a procedure Draw_Body which is a wrapper to call Draw_Sphere.

From the main loop call Draw_Body instead of directly drawing Draw_Sphere. Draw_Body should only take 2 parameters.

Question 4

Add a comet in motion around the Sun.