Enemy Shields

Jason Schneider
2 min readJan 13, 2022

Now that the player has more ammo available, I think the game needs to be made a tad more difficult again :). I think giving a random Enemy a shield that allows them to take an extra hit should do the trick.

In order to accomplish this, we need to create a new empty object; naming it, Shield. Creating a new tag, Enemy_Shield, and assigning it to this object. Then, we will need to add a circle sprite (to represent the shield) and a 2Dcollider to this object.

We will then need to add a script to this object similar to:

Then, we will need to drag and drop the respective objects into the newly created fields. In our SpawnManager script we will need to add functionality that will call the function EnemyShieldActivate() when a particular enemy is instantiated. We will also need to provide functionality that will call EnemyShieldDeactivate() when either the Player, Player’s laser or Player’s shield hits the collider of the Enemy shield.

This I will leave to you. The result will be similar to:

--

--