Game Development Reference
In-Depth Information
for the projectile it self after the preset time. The next thing to do is to get the direction
of the launching force. This direction is the vector between mouse position and projectile
position, which we get by subtracting these positions and storing the result in forceDirec-
tion . We then multiply the vector by launchPower to magnify its effect, and finally add it
as impulse force to the projectile. The last script to present is ProjectileGenerator , which is
responsible for generating a new projectile after destroying the previous one. This simple
script is shown in Listing 55. Illustration 67 shows the projectile hitting the boxes, which
is the result of the functional demo that can be found in scene18 in the accompanying
project.
Search WWH ::




Custom Search