Game Development Reference
In-Depth Information
By adding TargetFollower to the rocket, our prefab becomes ready to be created. So we
create the rocket prefab and then delete the rocket object from the scene. Now we have our
three prefabs: target, bullet, and rocket, we are ready to write the necessary scripts for the
shuttle. Before moving on to the shuttle, we have to complete our scene by adding few tar-
gets. For example, you can add two rows of targets in front of the shuttle, by dragging tar-
get prefab into the scene several times in the desired positions. You can then set movement
speed of first row targets to, say, (3, 0, 0) and the speed of second row targets to (-3, 0,
0). Now you have two rows of targets that move from right to left and from left to right.
Now let's add the script that allows us to control shuttle movement, which is ShuttleControl ,
shown in Listing 21.
Listing 21: A script for controlling the shuttle
Search WWH ::




Custom Search