Game Development Reference
texture ID. By using a pointer to a texture within the surface structure, we
ensure that a simple surface that defines only colour does not contain
unnecessary details about a texture.
When handling interaction, collisions are always an important considera-
tion. A character may collide with the background elements of a scene
and collision boxes can be used to handle this. The developer sets up a
series of boxes that define the geometry of the background in the simplest
way possible, then a collision check will detect if the central character has
fallen off a wall, is trying to walk through a wall or is underwater. A
character may intersect with another simple object such as a box; in code
you may want to trigger a cut scene animation whenever this happens.
Again, using a collision box list it is possible to route the code to the
appropriate place. A collision box needs dimensions and it also needs to
store the information about what to do in the event of a collision. You may
simply want to reorient the central character so that they are not walking
Figure 17.6 Collision boxes defining background collisions.