|
|
|
|
 |
| Keep track of the player's score, increasing it on every successful UFO hit, and draw the score on the screen using a sprite-based font. |
|
 |
Step 1 |
|
|
|
| Create a font definition file, and load the file in code to create a SpriteFont object. |
|
|
|
|
|
Step 2 |
|
|
|
| Create a new variable to track the player's score and increment it when cannonballs and enemies collide. |
|
|
|
|
|
Step 3 |
|
|
|
| Construct a text string with the player's current score and draw it on the screen using the SpriteFont and SpriteBatch objects. |
|
|
|
|
|
|
|