Game Development Reference
In-Depth Information
the mouse moves. Up and down mouse movements tilt the camera up or down,
which becomes important if the player wants the avatar to climb or descend, but
these commands do not move the avatar. Considerably more flexible than a joy-
stick-based system, mouse-based navigation allows the player to look around
without moving the character.
Keys on the PC's keyboard control movement. The standard arrangement for play-
ers who use their right hands for the mouse and left hands for the keyboard uses
W to produce forward movement in the direction the avatar currently faces; move-
ment continues as long as the player holds the key down. S works similarly for
moving backward (or applying the brakes). A and D produce movement at right
angles to the direction the avatar faces, left or right respectively, thus producing
the feeling of sliding sideways while facing forward. This sideways movement is
often called strafing . Left-handed players usually use the arrow keys or the I, J, K,
and L keys, whose layout mimics the W, A, S, and D keys.
Flying
Flying presents a further complication because it involves moving through three
dimensions whereas a two-dimensional input device such as a joystick offers con-
trol in only two. Control over movement in the third dimension must be handled
by a separate mechanism, either extra controller buttons or an additional joystick.
How you implement this depends on the nature of the aircraft itself, generally
using the mechanisms in real aircraft as your model. Navigational controls in mod-
ern flying games are almost always intended for the first-person perspective from
inside the cockpit. (See Chapter 17 for further details.)
FIXED-WING AIRCRAFT
The player maneuvers the aircraft using the joystick to pitch (the equivalent of a
camera's tilt) or roll the aircraft, and the engine pulls the plane in the direction the
nose faces. A throttle control, generally a slider or keys that increase and decrease
the engine speed by fixed increments, sets the rate of forward movement. When
flying straight and level, forward on the joystick pushes the nose down, producing
descent, and back pulls the nose up, causing it to climb. Left on the joystick causes
the plane to roll to the left while remaining on the same course; right rolls it to the
right in the same manner. To turn in the horizontal plane, the pilot rolls the air-
craft in the desired direction and pulls the joystick back at the same time, so the
nose follows the direction of the roll, producing a banked turn. When the joystick
returns to center, the plane should fly straight and level at a speed determined by
the throttle.
HELICOPTERS
Game user interfaces typically simplify helicopter navigation, which is more com-
plicated than flying fixed-wing aircraft. The joystick controls turning and forward
Search WWH ::




Custom Search