Antikris
01-30-2011, 06:58 PM
Be sure to read my previous guide (http://www.lbpcentral.com/forums/showthread.php?46673-How-to-make-a-simple-homing-missile&p=754481) first to understand the basics. Here we'll be making the missile set a lock onto a found target and give the target a short time to escape.
http://i.imgur.com/XzWYV.jpg
The main difference from the previous guide is that the missile no longer aims for a player, but aims for the lock object. You can see I made a small crosshair out of Halo material (20%). I glued another piece of Halo (0%) to it to be able to stick a chip in the center.
Instead of picking the player as a target, you can make the missile aim for whatever you like; just change the Followers on the lock to aim for a Tag (http://wiki.lbpcentral.com/Tag) and the Player Sensor (http://wiki.lbpcentral.com/Player_Sensor) on the lock to a Tag Sensor. We will be using one tag in this guide, though, so keep one reserved.
http://i.imgur.com/bBx6L.jpg
The missile here has its Look At Sensor set to follow the teal colored tag on the lock object. We have that tag stuck on both the missile as the lock circuitry, but that will become clear later on.
The missile will go through three distinct phases:
Fly around aimlessly. The lock will follow the missile around until it finds a target.
Target acquired. The lock will stick to its target and the missile will fly towards the lock.
Target locked. The lock will stop following the target and stand still. The missile will impact soon after. This is the time that the target has to escape.
http://i.imgur.com/NoQsS.png
Phase 1 - Fly around aimlessly
A Player Sensor (or a Tag Sensor (http://wiki.lbpcentral.com/Tag_Sensor) for alternative targets) will initiate phase 2 when activates, but a NOT gate behind it will make sure phase 1 is triggered (also, to return back to phase 1 in the rare case a target gets suddenly out of range, for instance by dying). The Follower (http://wiki.lbpcentral.com/Follower) of phase 1 tracks the missile's tag; set it to a very wide radius. Set the minimum range to 3 or 4 so that the lock's own tag will not trigger it.
Trying to save tags here; it would be a shame to have to use two unique tags alone for this missile. So, we'll use the same tag and a minimum sensor range.
A Selector (http://wiki.lbpcentral.com/Selector) is a neat way to switch between logic phases without having to manually reset everything from the previous phase.
Phase 2 - Target acquired
When the player gets into range of the Player Sensor, it triggers phase 2. The Follower of phase 2 is now chasing the player at maximum speed. Also, there is a small Timer set to 0.1s that resets itself and thus acts as a pulsar. It fuels a beeping sound here, as well as making the Halo crosshairs flicker.
Phase 2 also sets off a Timer that determines the time until the missile goes to the next phase.
I just realised I made a mistake: the timer does not get reset in case the system returns to phase 1; hooking up the phase 1 Selector output to the reset of phase 2's timer should do just that.
Phase 3 - Target locked
There is no longer a Follower in this phase but instead a simple Mover, set to 0% speed, 100% deceleration; this makes the lock stop dead in its tracks. Another pulsar with a different beep to indicate your last chance to escape.
Finally, the lock needs to disappear after the missile has destroyed itself; this can be done by linking an inverted Tag Sensor to a Destroyer (http://wiki.lbpcentral.com/Destroyer). Remember to set the minimum radius of the sensor to 3 or 4 to prevent the lock from blowing itself up.
Death from the sky. Enjoy (http://www.youtube.com/watch?v=zekiZYSVdeQ)!
http://i.imgur.com/XzWYV.jpg
The main difference from the previous guide is that the missile no longer aims for a player, but aims for the lock object. You can see I made a small crosshair out of Halo material (20%). I glued another piece of Halo (0%) to it to be able to stick a chip in the center.
Instead of picking the player as a target, you can make the missile aim for whatever you like; just change the Followers on the lock to aim for a Tag (http://wiki.lbpcentral.com/Tag) and the Player Sensor (http://wiki.lbpcentral.com/Player_Sensor) on the lock to a Tag Sensor. We will be using one tag in this guide, though, so keep one reserved.
http://i.imgur.com/bBx6L.jpg
The missile here has its Look At Sensor set to follow the teal colored tag on the lock object. We have that tag stuck on both the missile as the lock circuitry, but that will become clear later on.
The missile will go through three distinct phases:
Fly around aimlessly. The lock will follow the missile around until it finds a target.
Target acquired. The lock will stick to its target and the missile will fly towards the lock.
Target locked. The lock will stop following the target and stand still. The missile will impact soon after. This is the time that the target has to escape.
http://i.imgur.com/NoQsS.png
Phase 1 - Fly around aimlessly
A Player Sensor (or a Tag Sensor (http://wiki.lbpcentral.com/Tag_Sensor) for alternative targets) will initiate phase 2 when activates, but a NOT gate behind it will make sure phase 1 is triggered (also, to return back to phase 1 in the rare case a target gets suddenly out of range, for instance by dying). The Follower (http://wiki.lbpcentral.com/Follower) of phase 1 tracks the missile's tag; set it to a very wide radius. Set the minimum range to 3 or 4 so that the lock's own tag will not trigger it.
Trying to save tags here; it would be a shame to have to use two unique tags alone for this missile. So, we'll use the same tag and a minimum sensor range.
A Selector (http://wiki.lbpcentral.com/Selector) is a neat way to switch between logic phases without having to manually reset everything from the previous phase.
Phase 2 - Target acquired
When the player gets into range of the Player Sensor, it triggers phase 2. The Follower of phase 2 is now chasing the player at maximum speed. Also, there is a small Timer set to 0.1s that resets itself and thus acts as a pulsar. It fuels a beeping sound here, as well as making the Halo crosshairs flicker.
Phase 2 also sets off a Timer that determines the time until the missile goes to the next phase.
I just realised I made a mistake: the timer does not get reset in case the system returns to phase 1; hooking up the phase 1 Selector output to the reset of phase 2's timer should do just that.
Phase 3 - Target locked
There is no longer a Follower in this phase but instead a simple Mover, set to 0% speed, 100% deceleration; this makes the lock stop dead in its tracks. Another pulsar with a different beep to indicate your last chance to escape.
Finally, the lock needs to disappear after the missile has destroyed itself; this can be done by linking an inverted Tag Sensor to a Destroyer (http://wiki.lbpcentral.com/Destroyer). Remember to set the minimum radius of the sensor to 3 or 4 to prevent the lock from blowing itself up.
Death from the sky. Enjoy (http://www.youtube.com/watch?v=zekiZYSVdeQ)!