Graphics Reference
In-Depth Information
will result in smoother and more-natural-looking camera behavior than you would get by simply parenting the
objects.
Figure 15-18 The Camera actuator targeted on the Armature object
Using Properties, Messages, and States
In addition to sensors, controllers, and actuators, other features help make the Blender logic brick system a
powerful programming language all in itself. These include properties, messages, and the state system, a result
of the Yo, Frankie! open game project. Properties enable you to store and change values in the game engine
environment. They serve a purpose directly analogous to variables in an ordinary programming language. Mes-
sages provide another way for logic bricks to communicate with other logic bricks, even when they are not
directly connected. They can be useful for synchronization or cases when a logic brick should have an effect
that is broadly recognized by other logic bricks. States enable a kind of meta-level of control over sets of logic
bricks and can be used to enable or disable whole collections of logic bricks at once.
Setting Up Bad Guys
The game you're putting together in this chapter is a simple maze game in which the goal is to collect Cone
objects while avoiding evil wizard enemies. This section describes a simple setup for the bad guys that will
provide a challenge to navigate without being too confusing to set up.
It is loosely based on a much more complex tutorial example provided by BlenderArtists.org user Mmph!
His example uses a large number of logic bricks to create a rudimentary but convincing form of AI (artificial
intelligence) and is very much worth checking out at http://blenderartists.org/forum/showthread.php?t=100512 .
The method described in those tutorials is quite clever; however, it pushes the boundaries of what is advisable
to do with logic bricks. For effects as sophisticated as AI, Python scripting is probably the least-cluttered and
easiest way to work. Nevertheless, the simplified bad-guy movement logic presented here should give you a
clear idea of how properties work and how they can be used to control characters' behavior.
For the following tutorial, you can either append the BadGuy object to your own scene or use the
badguy_nologic.blend fileitselftofollowthetutorial.Theendresultofthefollowingstepscanbefound
in the file badguy_logic.blend . The initial setup looks as shown in Figure 15-19 .
 
 
Search WWH ::




Custom Search