Unity2D Devlog 21 — Never Miss Again!

Claudio Grassi
3 min readJul 12, 2021

Lately, I’ve been on a rollercoaster ride of balancing and counterbalancing game mechanics. It has been a blast. Now that enemies can dodge the Player’s bullets, maybe it’s best to include a weapon they can’t avoid.

Objective:

Create a new weapon type for the Player: The Homing Missile.

How I went about it:

As with every other power-up, I began by creating some art. If you see this bad boy coming towards you, you had better smash the acceleration pedal!

I am now ready to begin coding the behavior for this new weapon.

A homing missile has to perform a series of tasks after being fired. The first of these tasks is to find all available targets in the area. To accomplish this step, I wrote the following code.

The method first looks for all Enemy Components in the scene. After looping through each element, it returns the closest enemy in the Array.

--

--

Claudio Grassi
Claudio Grassi

Written by Claudio Grassi

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

No responses yet