Game Development Reference
In-Depth Information
17.
At the end of the actions list, include a
Test Variable
action (
control
tab) that checks if
the
Variable
state
is
equal to
ESTATE_ATTACK
.
18.
Follow this with a
Start Block
action.
19.
Include a
Speed Horizontal
action (
move
tab) that sets
Hor. Speed
to
0
.
Include a
Test Variable
action (
control
tab) with
global.step_count
mod
4
for
Variable
,
equal to
for
Operation,
and
0
for
Value
. This will now perform the next action every
fourth step as we have done in a similar way before. This makes sure that there will be
gaps in the stream of missiles coming from the Beastie.
20.
21.
Include a
Create Moving
action (
main1
tab) that creates an instance of
obj_beastie_missile
at a
Relative
position of
X
=
0
,
Y
=
-12
with a
Speed
of
6
and a
Direction
set to
point_direction(0,0,facing,0)
. This last part is another function that
provides the angle between two points. By using
0
,
0
and
facing
,
0
as the two points, we
are simply obtaining an angle for the facing direction (that is, 0 degrees for
FACE_RIGHT
and 180 degrees for
FACE_LEFT
).
22.
Include an
End Block
action (
control
tab). There should now be 26 actions in the
Step
event for
obj_beastie
, as shown in Figure 5-9.
Search WWH ::
Custom Search