Graphics Reference
In-Depth Information
Figure 15-22
Visibility toggle
TheremainingsensorsareallPropertysensors,meaningthattheytriggereventswhenevertherelevantprop-
erty has a specific value. The first one represents the case when the
visible
value is 0. It connects to a Visib-
ilityactuatorsettoInvisible.Sobydefault,thepathnodeswillbeinvisible,becausethestartvalueof
visible
is 0. The next sensor down represents the case in which the value of
visible
is 1. This triggers a Visibility
actuator set to Visible. Finally, the Property sensor for the case when the value is 2 triggers another Property
actuator, this time an Assign actuator, which assigns a 0 value to the property, thus resetting the toggle.
After you've set up the logic on the first path node, copy the object three times and place the objects around
the maze as shown in
Figure 15-22
.
Name the objects
1
,
2
,
3
, and
4
so that they are positioned in numerical
order.
Bad-Guy Logic Bricks
To keep things reasonably uncluttered, I'll describe the bad-guy logic in several steps. The first thing to do is to
setupthenecessary physicsandproperties, asshownin
Figure15-23
.
Like themain character,thebadguywill
be a dynamic actor, but without rigid body physics. It will have two integer properties. The
targ
integer prop-
ertyrepresentsthetargetnodethatthebadguyispresentlymovingtoward.The
inc
propertywilleventuallybe
usedtodeterminewhetherthebadguyistraversingthepathnodesinincrementingorderorindecrementingor-
der,thusmovingclockwise orcounterclockwise aroundthepath.The
wizard
propertywillenable othergame