Game Development Reference
In-Depth Information
34.
Follow this with a
Set Variable
action that sets the
Variable
state
to
ESTATE_WAIT
. Of
course, this should really be
ESTATE_ATTACK
because we want the Beastie to shoot when
Zool is closer than 150 pixels away. However, we're not going to add the attack state
until a little later on, so we'll always just switch to the wait state for now and come back
and change this later.
35.
Follow this with an
Else
action.
36.
Follow this with a
Set Variable
action that sets the
Variable
state
to
ESTATE_WAIT
.
37.
Include a
Set Alarm
action (
main2
tab) that sets
Alarm 0
to
30
Steps
.
38.
Include an
End Block
action (
control
tab). There should now be 20 actions in the
Step
event of
obj_beastie
, as shown in Figure 5-7. Notice how the actions for
ESTATE_DECIDE
occur after the actions for
ESTATE_MOVE
, which is the only way of getting into the
ESTATE_DECIDE
state. Also note that by the end of these
ESTATE_DECIDE
actions, it is
impossible for the state to still be in
ESTATE_DECIDE
. This is important, as we have no
sprite to draw for
ESTATE_DECIDE
, so it shouldn't ever finish in that state.
Figure 5-7.
The Step event of the Beastie object. Note that both of the state transitions from
ESTATE_DECIDE go to ESTATE_WAIT at this stage
Search WWH ::
Custom Search