Coding the player's and the background's empty component classes
Coding an empty class for each player-related component will allow us to quickly write the code to get the game running. We can then flesh out the real/full code for each component as we proceed, without the need to dip into the same class (mainly GameObject
) multiple times.
In this chapter, we will deal with the player (and their lasers) and the background. Coding the empty outlines will also allow us to code an error-free GameObject
class that will hold all these components. By doing this, we can see how the components interact with the game engine via the GameObject
class before we code the details inside each component.
Each of the components will implement one of the interfaces we coded in the previous section. We will add just enough code for each class to fulfill its contractual obligations to the interface and thus not cause any errors. We will also make very minor changes outside the component...