Shoot ’em Up
What does a game of this kind need above all else? Something to shoot up and bullets to evade. In this chapter, you’ll be adding enemies to the game and even a boss monster.
Both enemies and player will use the new BulletCache class to shoot a variety of bullets from the same pool. The cache class reuses inactive bullets to avoid constantly allocating and releasing bullets from memory. Likewise, enemies will use their own EnemyCache class because they, too, will appear in greater numbers on the screen.
Obviously the player will be able to shoot these enemies. I also introduce the concept of component-based programming, which allows you to extend the game’s actors in a modular way. Besides shooting and moving components, ...