Game Development Reference
In-Depth Information
and
OnMessage
sections of the states. As the names implies, an
Actuator_Call
placed inside the
OnEnter
section execute when the state is entered. Any
Actuator_Call
placed inside the
OnUpdate
sectioniscalledoneveryupdate,and
any
Actuator_Call
placed inside the
OnExit
section is called when the state is
being exited. The
OnMessage
section of the states is a bit different from the other
sections. Any
Actuator_Call
placed inside this section must have a
GameMessage
specified along with it, and is only called when that
GameMessage
is received by
the state.
An FSM is built in Eberos GML2D by linking states together with
TransitionEvent
links. Currently, a
TransitionEvent
link represents an edge
from one
State
to another
State
,orone
GlobalState
to another
GlobalState
and specifies the message that triggers the transition from such state to another.
Finally, a FSM modeled in Eberos GML2D is only valid if every state in the Eberos
GML2D game model is reachable.
19.1.4 Sprite and Animations
In Eberos GML2D, a
Sprite2D
represents the resource image file for a sprite or
spritesheet(see
Figure19.5
)
.Thisconstructholdstheinformationspecificto
that file, such as the resource URL, the image width and height (in pixels), and
where in the screen it will be drawn by default. The screen detination is used in
particular in the case of modeling a heads-up display (HUD) or a menu. In the
case when the sprite is actually a spritesheet containing multiple animations, this
can be modeled using one of the two animation constructs,
AnimationStrip2D
or
CompositeAnimation2D
.
Figure 19.5.
Basic class diagram for entity-to-sprite relationship.