In this chapter we took what we learned in the previous two chapters and built up a collection of systems that allow us to implement the actual gameplay of the game. We went from some sample code to test out rendering and input, and added structure so that we can easily define input actions that can be triggered by multiple devices. We restructured our rendering so that the textures can be re-used and centralized the drawing functionality so that with one call we can draw every sprite and piece of text required.
From there we added in gameplay by adding in the Player
, Enemy
, and Bullet
classes and the supporting Ship
class. We added the code required to spawn new enemies and fire new bullets, an also looked at the caching techniques we could use to manage both of those.
Then we added destruction with a simple collision system that allowed us to easily manage collision shapes that allow us to make collision detection faster. This was the big piece of the puzzle needed to lock in the...