.

CAB202 Topic 3, Exercise 3: Shooting Star

Requirements:

Complete the implementation of the shooting_star program. This program simulates the flight of an object along a straight line between two points. The hash-tags for this exercise are: #cab202 and #cab202ShootingStar.

This exercise will give you further practice with collision detection and help you learn how to direct an object along a path between two points in a two-dimensional space.

In this program, you will use a sprite to represent the location of a bomb which, after launching from position (10,5) , flies straight toward a star which is located at (53,10) at a speed of 0.1 screen units per time-step. To complete the program, follow the instructions detailed in the in-line comments in the setup() and process() functions.

Notes

The supplied test driver produces output similar to that shown below.

CAB202 Topic 3 Exercise 3

The sample image and movie were generated with the settings listed in the “Movie V alue” column in the table below. The settings you should use in your submission are listed in the “Y our Value” column.

ParameterMovie ValueYour Value
Terminal width79n/a – set by AMS
Terminal height29n/a – set by AMS
Initial bomb x1710
Initial bomb y135
Star x5853
Star y2210
Bomb speed0.15 units per time step0.1 units per time step

If you would like to record your own ZDK Movie to compare the frames against the reference movie, add the following option to your gcc command:

-DAUTO_SAVE_SCREEN

This will enable the auto-save function in the test driver, causing it to produce a text file containing your movie. The file will be created in your present working directory. Each time the program runs, a new file is generated.

Use this test driver to implement and test your function prior to submission.

Submitted files:

.