Unity2D Devlog 21 — Never Miss Again!
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.