In this section, we will learn how to create the enemies for our Tower Defense game.
Since we will see how the game manager will spawn a lot of enemies later, in Chapter 9, Finishing the Game, we need to create a prefab to store all the data for one enemy, including its graphics, components, and scripts.
By right-clicking on the Hierarchy panel, we can select 2D Object/Sprite in order to create a new Sprite
. Of course, we need to assign the graphic and adjust its dimensions to fit our game environment. In this case, we can chose the slime_red
as our enemy. Like the previous components, towers and bullets, it also needs to be scaled. In this case, we can set the whole scale vector to 0.8
. Furthermore, we should set the value of the Z-axis, for the position, to -1
. Once we have done this, it should look like this:
In order to be detected by the towers, our enemy should have the enemy
tag. Since we have already created this tag in the bullet section, it can easily...