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.
- 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.
- Ability to adjust the speed of the missile.
- 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.
- 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.
- “When the missile is close to the target increase the speed using an “InKillRange” and “RammingSpeed” variables.
- Increase the length of the missile exhaust flame during “Ramming Speed”.
- Apply sound effects for all flight modes, enemy collision, and self-destruct.
- 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….