Game Development Reference
In-Depth Information
Exercises
1. In Listing 6 in page 26, we implemented a platformer input system. Some games
of this type allow the player to increase the speed of character using a special key.
Declare a new variable and call it runSpeed , and give it a value greater than normal
speed if the character. After that add code that scans left shift key (use KeyCode.Left
hift ). If the player is holding left shift then use runSpeed for movement to make char-
acter move faster, or use default speed if the player is not pressing shift You may
apply running on other input systems as well if you wish.
2. When we implement person movement systems such as platformer, first
person, and third person systems, we did not take into account acceleration and
deceleration of the movement. Try to make use of acceleration/deceleration
mechanism we implemented in Listing 12 in page 50 to enhance movement in
these systems. For example, you can prevent sudden stop of the character during
jumping, since it must be driven towards jump direction until it land on the ground
again. You can implement this mechanism in any way you see appropriate.
3. Try to use car camera script in Listing 13 in page 54 with third person input
system instead of adding the camera as child to the player character. What changes
you need to do to let the player control the character easily using new camera
system?
4. Modify plane control script in Listing 14 in page 59 so that plane return to its
original rotation when the player releases control keys. You have to do
computations similar to those in car camera, since you need to find the amount and
direction of the rotation and when to stop rotating. Apply this to rotations on both x
and z axes.
Search WWH ::




Custom Search