Bullets
In this section, we will learn how to create the bullets that our towers will shoot against the enemies.
Creating the bullet prefab
Since these bullets are going to be thrown by the towers, we need to create a prefab that allows us to quickly instantiate one of these. In our game environment, the bullets will be arrows. Feel free to use your own graphics, if you have any.
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 of the arrow, which can be found in the graphic package, and adjust its scale to fit our game environment. In this case, we can set 1.5
to the whole scale vector. Furthermore, we need to set the Z-axis of the position to -2
. In the end, the arrow should look like this:
Next, we need to assign a tag to it. Therefore let's click, in the Inspector, on Tag/New Tag
. Now the Inspector should display the Tags and Layers menu. Since we are interested in tags, expand the Tags menu...