Previous Iteration

Iteration 2: Draw and move player’s bullet

In this iteration you will add artefacts to model and move the bullet that the player is going to throw. At the end of this iteration you will have a bullet shooting from the player ship when the space bar is pressed.

First you will create your ownbulletrecord. Table 3 contains a data dictionary that describes the fields of the bullet record/structure.

Type

Field Name

Description

Sprite

bulletSprt

To make the bullet a sprite

Boolean

inUse

To see if the current bullet is active

Table 3: Data dictionary for the space invaders Bullet record

Modify the Player record and add another field in that record to store
information about the player’s bullet. Table 4 contains a data
dictionary that describes the additional field of the Player
record/structure.

Type

Field Name

Description

Sprite

Fighter

To make the player a sprite

Bullet

playerBlt

To store information about player’s bullet

Integer

Life

Number of lives a player have

Table 4: Data dictionary for the space invaders Player record

Next we need to create functions and procedures to interact with the bullet’s data.

Figure 4: Structure Chart for Iteration 2 with functions and procedures to work with the bullet’s data