Game Development Reference
In-Depth Information
Literal Translation
Now look back at Figure 11-1 and compare the GML on the left with the actions on the right. It
follows exactly the same structure as the original sequence of actions for this event. We've even
added comments (in green) to show you the equivalent action for each line of GML code. In this
case, there were 13 actions that have converted into 13 lines of GML, but this will not always be
the case. In zooldrag.gmk , we have directly mapped each action sequence into the equivalent
GML without taking any shortcuts to make it easier for you to relate the GML back to your
previous experience with actions.
So for every action you can use in D&D programming, there is an equivalent piece of GML
that does the same job. We've compiled a list of the most common actions from Zool and how
they translate into sequences of GML instructions that have similar, or identical, results. Take
some time now to look through the new GML version of Zool and see how the original actions
have been replaced with code that creates a comparable outcome.
Actions and Their GML Equivalents
1.
Include a Set Variable action that sets the Variable x to the Value 3 .
x = 3;
(standard)
x =
x+
3;
( Relative option checked)
Include a Test Variable action that checks if the Variable x is equal to the Value 3 .
if( x
2.
( equal to )
==
3 )
if( x
>
3 )
( greater than )
if( x
<
3 )
( less than )
Include a Start Block action.
3.
( Start Block )
{
}
( End Block )
else
( Else )
Include a Change Instance action to change into obj_dragon with Perform events set
to yes .
instance_change( obj_dragon,
4.
( Perform events set to yes )
true
);
instance_change( obj_dragon,
false
);
( Perform events set to not )
Include a Speed Horizontal action with Hor. Speed set to 3 .
hspeed = 3;
hspeed =
5.
hspeed+
3;
( Relative option checked)
Include a Speed Vertical action with Vert. Speed set to -4 .
vspeed = -4;
6.
(standard)
vspeed =
hspeed
-4;
( Relative option checked)
 
Search WWH ::




Custom Search