Chapter 5 Collision Theory and Logic 131
The following logic statement can be used to program the end of the
balloon pop game.
IF
number of darts 0,
THEN
load one dart in the hand,
ELSE
display the message “Game Over.”
This statement describes what happens each time the player throws a dart.
If there is still a dart available, then the player gets to throw another dart.
Otherwise, the game is over, Figure 5-9.
Collision Theory
The most used condition in video game design is collision. You may
guess the concept of collision theory deals with an object running into or
hitting another object. It does. However, also included in collision theory is
the idea that when objects collide the movements, animations, and events
must provide an illusion of reality.
One of the most diffi cult concepts for begin-
ning designers to grasp is that a picture of an
item does not act the same as the real item.
When programming a game, the fact that an
object looks like a wall does not make it act like
a wall. For it to act like a wall, the object must be
programmed with the properties of a wall.
Figure 5-8. A game should tell you what is missing when
trying to complete an objective. Here, the game is telling the
user the key must be located to open the door and enter the
next level.
No darts remain
Figure 5-9. When a dart is used, the computer looks
at the number of darts to see if more than 0 darts are
available. Here, the result of the test is FALSE since the last
dart has been used. The computer then initiates the ELSE
operation to display the game over screen.
CHEAT CODE: PROPERTIES
Images used in video games are
programmed to work properly by setting
the object’s properties. Visibility,
interactivity, and movement are some
of the properties assigned to an object
to make it act like a real item.