141
Chapter 4 Perspective, Scene Design, and Basic Animation
Everything in a game frame is located with a
coordinate system.
The
coordinate system is very similar to the coordinate graphing you have done in your
math and science classes. It involves the X coordinates (left and right, horizontal
directions), Y coordinates (up and down, vertical directions) and Z coordinates
(depth or closer and farther directions). In 2D games the Z value is always 0.
If you remember Cartesian coordinates from your math class, moving to
the right of the origin, the value of X changes in the positive direction. When
you move up from the origin, the
value of Y changes in the positive
direction. The coordinates of the
origin are written as (0,0,0). This
means X, Y, and Z all have a value
of zero. The X value is always first,
followed by the Y value and then the
Z value. Since the Z value is always
zero in 2D games, it can be removed
from the coordinate set. Then, the
origin is written (0,0), as illustrated
in Figure 4-21.
If you move to a different point
other than the origin, you need to
identify where on the X and Y axis
Figure 4-20.
Enterbrain, Inc.; Goodheart-Willcox Publisher
This goblin avatar has 16 poses to animate walking in four directions (North, South, East,
and West). Sprites traveling in more than four directions need more poses. If the goblin
sprite needs to move northeast, a new animation set for that direction must be created and
programmed into the game.
Figure 4-21.
This is the coordinate
system used for 2D
games. The Z value
is always zero. Some
game engines flip the
negative and positive
directions for the Y
axis (negative on top,
positive on bottom).
Goodheart-Willcox Publisher
Previous Page Next Page