Unity2D DevLog 15 — Shields and Lasers

Claudio Grassi
4 min readJun 7, 2021

Enemies can shoot, and they can move in different ways. Now it's time to extend their life expectancy.


Create a new enemy that can take more than one hit.

How I went about it:

It is a simple idea that was just as simple to implement. Besides creating a new sprite for this enemy, I also had to write a short addition to my enemy’s Script to make this work. The idea is to allow this type of enemy to take more than one hit; Forcing the player to concentrate fire on them to assure their destruction.
This extra time that forces the player to remain in one spot provided a new opportunity. I already have one enemy that shoots at the player. Why not two?

I started once more by creating new art for my Shied-Bearing Alien. I realized that if the alien lost their shield, they would have to continue without it. I had to make sure to create animations for both conditions.

I made sure to include a small animation for when the shield breaks as well.

Next, I dove into the enemy Script to make a few changes.

I added a bool to control the shield’s behavior. Setting it to true will make sure that the first hit does not destroy the alien. I can set the value of this bool in the inspector when I create the new Alien’s Prefab.

Next, taking advantage of the fact that the player may linger in front of this new alien, I want to create a new type of enemy attack. The alien will sense the player’s position and fire a laser from its glowing eye!
I started by creating a new script to control this behavior. I will have to rely on a Raycast to check from the player before firing the laser.

Claudio Grassi

Experienced digital artist, Unity game developer & coder with a knack for problem solving and a passion for video games.