12 More enemies

This chapter covers

  • Defining more enemy types
  • Keeping track of enemies
  • Changing our enemy spawn code
  • Changing our enemy movement code
  • Making our smart bomb smarter

So far, our game only has one type of enemy, which always moves the same way. This does not present much of a challenge to the gamer and does not make the game very interesting.

In this chapter, we are going to look at how we define different types of enemies in our game code. Then we will look at how we will keep track of more information about each enemy. This will allow us to make the enemies move in different directions and patterns and to introduce some animation.

12.1 Defining more enemy types

To make our game more interesting, let’s add some more enemy types with different looks and behaviors. Our first step will be to include a table in our code that defines the different attributes each type of enemy will have. Some of these attributes could include

12.2 Keeping track of enemies

12.3 Changing our enemy spawn code

12.4 Changing our enemy movement code

12.5 Making our smart bomb smarter

Summary