178
Video Game Design Foundations
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 characters unless one has a
magical ability or flight. 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 gameplay,
you do not expect Spiko to be able to run over the water, rather sink in it,
because that is what the game rules state. Instead, Spiko runs across the water,
as shown Figure 5-11. 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 statement, it will not alter the
character’s movement.
A
collision statement
must exist
for each object the player touches.
If no collision statement exists,
CHEAT CODE: COLLISION
STATEMENT
A collision statement is a logic
statement that has the condition
side of an event beginning with two
or more objects colliding.
Figure 5-10.
Shutterstock.com
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.
Previous Page Next Page