Game Development Reference
In-Depth Information
nextLaunch = Time.time + frequency;
var projectileInstance : GameObject = Instantiate(projectile,
transform.position, transform.rotation);
projectileInstance.rigidbody.AddForce (projectileInstance.transform.forward
* force, ForceMode.Impulse);
Destroy(projectileInstance, 2);
}
}
Save the script and save the scene. Now when you playtest, the cannon zone has a nice distribution
of cannons and projectile frequencies (Figure 10-7 ).
Figure 10-7. The completed Cannon Zone
You can easily add another cheat code to facilitate your testing by adding the following to the
RelocatePlayer() function in the Cheats script:
else if(Input.GetKeyDown(KeyCode.Alpha3)) {
relocationPoint = Vector3(0, 9, 43);
RelocatePlayer();
}
Make any adjustments you feel improves the gameplay to your satisfaction. Don't forget to save the
scene and save the project. Another zone complete—woo!
Pendulum Zone
In keeping with the game design that has varying levels of intensity with each zone, the cannon zone
is of higher intensity than the moving platform zone, while the pendulum zone is of a lower intensity
than the cannon zone, which in turn is more challenging than the previous low-intensity moving
platform zone. That's a lot of ups and downs!
The pendulums are already built. If you want to add to the difficulty of this zone, you can change their
number, size, and properties. If you want to move them around, you can select the pendulum ball with
the chain links as a group by holding down the left mouse button while dragging the cursor over them.
A transform gizmo appears, which you can use to move them as a collection where they maintain
their position relative to one another. Since they are a group, take a moment to create an empty game
object to serve as a Pendulum parent game object, then do the same for the other two. This is a simple
prototype—imagine how cluttered and unwieldy the Hierarchy could get with a more complex game!
 
Search WWH ::




Custom Search