Game Development Reference
In-Depth Information
3.4 Triggers and usable objects
In addition to object holding, players can perform another actions that manipulate the scene.
For example, the player can activate or deactivate some devices, such as electrical lights.
This activation or deactivation is called triggering, because a player performs an action that
triggers another action. When the player switches light on or off, he deals in fact with the
power switch, and the switch makes the effect. The switch in this case is called the trigger,
since it is responsible for performing the action. In the same example, the player is the
activator of the trigger, and the one who decided to perform the action.
In this section we are going to look at a general solution for usable triggers. Therefore, the
code might seem complex at the beginning, but in the long run it provides a portable pattern
that can be used in almost every situation. The scene we are going to use in this section is a bit
more complex than previous scenes, and it going to have a number of objects that are neces-
sary to illustrate the complete picture. Let's begin with Illustration 38, which shows how does
our scene look like.
Search WWH ::




Custom Search