Game Development Reference
In-Depth Information
This code relies on the PsaajArajp class, so it needs to be imported with this directive:
The code adds a IKPEKJ[BEJEOD event to the [psaaj object:
IKPEKJ[BEJEOD is one of the events from the PsaajArajp class. It's triggered when the animation is
finished. In this case, it's set up to call the kjIkpekjBejeod event handler:
arajp*p]ncap refers to the [psaaj object, not the object that's being animated . This is important to
remember. The ukuk method tells the [psaaj object to play its animation in reverse. Because this
event handler is called every time the animation finishes, the direction is reversed each time. Very easy
to implement, and it's a great effect.
There are six events in the PsaajArajp class that you can use with Psaaj objects (see Table 10-6).
Table 10-6. TweenEvent class events
TweenEvent class events
It's triggered when . . .
The object being animated moves.
The animation is finished.
The animation is started from the beginning again.
The animation is started after having been stopped.
The animation stops playing.
The animation starts playing.
As you can see, with a bit of imagination there's quite a bit of untapped power here at your disposal to
build very sophisticated scripted animation environments for games. You can use these events to start,
stop, and change an object's animation based on any conditions in your game.
Search Nedrilad ::

Custom Search