182
Video Game Design Foundations
arms flailing? Adding a realistic animation after the collision will help with
the illusion that an object is solid. An example of that programming might
look like this:
IF
the coyote collides with the brick wall,
THEN
the coyote will move backward
AND
the animation will change from walking to falling down.
Collision theory controls almost every interaction in video game action.
The computer follows the programming of the collision statements that keep
objects moving, stopping, exploding, or standing on a platform. Just because
it is blue and has waves, does not make it water. The computer does not make
these types of visual assumptions; only programmers do! The computer would
be just as happy allowing a character to walk on water and sink in land than to
do it the way things occur in nature. The game world is yours to create. If you
want people to walk upside down or walk on liquids, then program interactions
in that way.
Consider the following situations. Read the statement and then determine
an appropriate logic statement for the situation. On a separate piece of paper,
write the logic statements to describe the conditions and events.
1. The grasshopper jumps on a piece of food and the player earns 100 points.
IF
collides with ,
THEN
add to score.
2. The grasshopper jumps on a lily pad and does not fall into the water.
IF
collides with ,
THEN
stops.
3. The grasshopper runs into a mushroom, falls into the water, and loses a life.
IF
collides with ,
THEN
movement falls
AND
loses one life.
4. The grasshopper runs into a four-leaf clover and earns 50 points and an
extra life.
IF
,
THEN AND
.
5. The player achieves 10,000 points and receives a bonus extra life.
IF
equals ,
THEN
add to the number of remaining .
Think about how collision theory works
in a bowling game. What collisions need
to take place? How would collision theory
apply when programming the falling of the
bowling pins?
UP!
5.5
Writing a Logic Statement
Previous Page Next Page