Summary
So, we are finally through with this chapter. We covered a lot of ground in this chapter, where we added enemies and made them shoot bullets. Also, we added player rockets, which used the same class as the enemy bullets. We also refined the controls of the player so that the player can concentrate on playing the game instead of checking where the fire button is on the screen.
As an exercise, you can create different types of enemies and add different types of projectile depending on the type of enemy. Depending on the type of enemy, you can load a different enemy and make them move differently in the update function of the enemy class. Also, if you wish, you can make him fire different types of projectiles that have a completely different behavior. I will leave it to you to figure it out on your own.
We still need to add the collision mechanics and scoring in the game, which we will be covering in the next chapter.
If you have any trouble understanding the code, remember that you can...