Unity2D Devlog 18 — Now You See It, Now You Don’t

Claudio Grassi
2 min readJul 6, 2021

PowerUps can activate powerful weapons, be used to reload ammunition, and heal damage. The Player must take advantage of them to survive. It’s time the Aliens fought back with more devious means.

Objective:

Allow the enemies to detect and shoot at power-ups that lay in their path.

How I went About It:

I have done most of the work required for this new mechanic. Aliens can already detect the Player and shoot at them. The only thing left to do is to include power-ups in the list of viable targets.
Currently, the Alien Shooting Script uses LayerMasks to identify the Player as a target. I only need to create a new Layer for the power-ups and add it to the Alien Shooting Script.

Next, I need to include a few lines of code in the PowerUp Script.

Taking advantage of the explosion Prefab that the Mimic uses, I can add some visual representation of the destruction of the PowerUp.

I can now call this method from the AlienBullet Script.

--

--

Claudio Grassi

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