First look at the gameplay screen
Right now, the gameplay screen is somewhat barren, so next we will add the Heads-up-display (HUD) for the game. The HUD is the portion of the game’s interface that displays vital information to the user such as the current score.
However, we will also need some additional variables to keep track of the information we are about to display and it will be a great opportunity to introduce some of the game classes in order to encapsulate some of the information.
Our first task, therefore, will be to create basic versions of the Player class and its two sub-classes – Human and AI.
Create a new project folder under the CatapultGame project and name it Players.
Create a new class under the Players project folder and name it Player.
At the top of the newly created class file, add the following using statements:
Since the player will eventually be responsible for drawing its associated catapult, it could be considered a game component that can be drawn to the screen. Change the Player class to inherit from the DrawableGameComponent class, and also make it internal since it will eventually contain some data which is internal to the game:
internal class Player : DrawableGameComponent
Page | 35