How to Create a Homing Missile Part 1

Objective: Create a script to guide our missile to the nearest enemy.

Welcome to the first part of this series. In this article, we are going to create some requirements for the functionality of our homing missile. So let's get started.

  1. The projectile needs to target the enemy and set an optional bit so another missile will not target the same enemy. This can be disabled when attacking stronger enemies.
  2. Ability to adjust the speed of the missile.
  3. If there are no enemies in range the missile should come to a stop to save fuel and wait for an enemy during the “Stop and Wait” mode. Turn off the missile exhaust flame during the “Stop and Wait” mode.
  4. Set a duration time for the missile “Stop and Wait” If the time is set to zero then disable the “Stop and Wait” mode and the missile will continue in a straight line.
  5. “When the missile is close to the target increase the speed using an “InKillRange” and “RammingSpeed” variables.
  6. Increase the length of the missile exhaust flame during “Ramming Speed”.
  7. Apply sound effects for all flight modes, enemy collision, and self-destruct.
  8. Test functionality by launching 3 missiles at a time. Each missile should attack a different target.

In part 2 we will create variables and identify the scripts we need to communicate with and acquire the reference handles to the necessary components. Until next time….