132 Video Game Design Foundations
A good example of how an image is not
a real object can be found in cartoons. The
old cartoon trick is to paint a black spot on the
ground, Figure 5-10. The black spot looks like
a hole, but it is just paint and you should be able
to simply walk right over top of the black spot.
The key here is interactivity. Interactivity is
how one object behaves when it encounters
another object. In the cartoon, the interactivity is
defi ned so the black spot actually functions like a
hole. When a character walks onto the black spot
(interacts with the hole), they fall into the hole.
The black spot is just an image unless you
tell the computer to make it act like a hole. To
create the properties of a hole, the hole must
be programmed so the computer knows how to
react when the player comes in contact with the
spot. The programming interaction would look
something like this:
IF
the coyote collides with the black spot,
THEN
the coyote falls.
The black spot is still not an actual hole, just an
object that triggers a fall event by the coyote.
This provides the illusion that a black spot is
really a hole.
In the cartoon, the coyote falls through the
painted hole, while the roadrunner is able to pick up the black spot and run
away. Here, the hole reacts differently for two different characters. This would
be contrary to collision theory. The hole should act like a hole for all the charac-
ters unless one has a magical ability or fl ight. Anything else would be a glitch.
Collision theory works throughout the game environment. Every object
including the background must be programmed to look, feel, and act like it
should. Imagine a scene from the Spiko the Hedgehog game. During game-
play, Spiko jumps onto a grassy platform, Figure 5-11. You expect Spiko to stay
on the platform and walk over to the coin. Instead, Spiko falls through the plat-
form and off of the screen. What is going on here? This common glitch happens
when the designer forgets to apply collision theory to the entire scene.
The designer needs to program the platform to act like a solid object.
That is to say,
IF
the character collides with the grassy platform,
THEN
Spiko
stops falling. The gravity setting makes Spiko fall
until he collides with an object programmed to
act solid. When an object has no collision state-
ment, it will not alter the character’s movement.
A collision statement must exist for
each object the player touches. If no collision
statement exists, then the player cannot interact
with it. Take the example of a player fl ying an
airplane. There is no collision statement for
A
B
Figure 5-10. A—The coyote can stand on the black spot
because the spot has not been programmed to be a hole.
B—The coyote now falls into the hole. The difference is collision
programming to make the coyote interact with the hole object.
CHEAT CODE: COLLISION STATEMENT
A collision statement is a logic statement
that has the condition side of an event begin
with two or more objects colliding.