170
Video Game Design Foundations
The first concept of designing and programming a video game is an action–
reaction relationship. To create a game environment that the player can control,
the player’s actions must cause something to change or react. This is the
action–reaction relationship.
Often, obstacles and challenges are placed within
a game to force the player to take action.
Programmers use logic
statements to break down these
action–reaction relationships.
For example, if the action is
colliding
your go-cart into a
banana peel, the reaction will
be the go-cart spinning out,
as illustrated in Figure 5-1. To
begin this programming process,
you will need to understand
the five basic operators of a
programming language: IF,
THEN, AND, OR, and ELSE.
Logic
CHEAT CODE: COLLISION
Collision is the most-used action
command in game programming.
Often substituted with hit or touch,
a collision occurs when an object
contacts something. This may be a player contacting an
obstacle or other player. It may also be two obstacles
contacting each other.
Figure 5-1.
Goodheart-Willcox Publisher; images: Shutterstock.com
The go-cart spins out when it hits the banana peel. This can be written as an IF…THEN
statement: IF the go-cart hits the banana peel, THEN it spins out.
Previous Page Next Page