Next page | Contents page |

Exercise 9 - sunrise

Further extend the program from exercise 8 so that on pressing a certain key (choose one that is not already used) the Sun moves smoothly at a constant rate from the starting position to behind the cloud.

For extra coolness can you make the Sun follow a circular arc instead of a straight line?

Another possible enhancement would be to start with the Sun below the horizon and change the colour of the sky as it rises.

The coordinates of the centre of our circular shape are xc and yc, NOT x and y as shown on the previous page. x and y would be suitable for rectangles, the way we have defined shapes.
Next page | Contents page |