Chapter 5 Collision Theory and Logic 133
the sky or the clouds. This allows the airplane to fl y through these objects
without any reaction. However, if the airplane collides with a bird, then the
engine would sputter and plane would lose altitude. Therefore, birds are
programmed to trigger interaction events when touched. In other words, the
bird objects have a collision statement.
Remember, just because an object looks like a dart does not mean a
balloon will pop if the dart touches it. In the balloon pop game, if an event is
not associated with the condition:
IF
the dart object collides with the balloon object
then nothing will happen when the dart hits the balloon. No events will
occur at all, no balloon pop, no explosion, and no increase in score. The
computer has no way of knowing the proper event unless you tell it exactly
what to do and how to do it.
This can be a diffi cult topic to understand. It is easy to think that if an
object looks like grass, then it should act like grass. That is true in real life.
A real grassy surface stops you from falling to the center of the earth. But,
this real-world logic does not apply in a video game. In a video game, the
grass is just an image of a grass. The object will only act like real grass if the
designer programs it to do so. Every interaction with the grass object needs
to be programmed to react as though it came in contact with real grass.
Spiko does not
sink in the water
Figure 5-11. In this platform game, Spiko the Hedgehog, the main character must walk on the grassy platforms to reach
the gold. However, notice the glitch in this game. Spiko can walk on the water hole, when he should sink. The collision with
the water was incorrectly programmed to act as solid platform.
Previous Page Next Page