Animation
by Ryan McKenzie · in Torque Game Builder · 01/21/2007 (10:01 am) · 2 replies
By taking samples of code from the "miniPlatform tutorial". I can easily understand how to make my player animate when responding to keys. But what i'm questioning is how could I arrange the code so that (for example)...when i hit the left key my player will play an animation and as soon as thats finished, follow onto a 2nd animation and then loop the 2nd animation. So how can I script these actions??
Ryan
Ryan
About the author
#2
* onAnimationStart(%this)
* onFrameChange(%this, %frameIndex)
* onAnimationEnd(%this) //this is the one you probably are looking for
01/22/2007 (1:14 am)
You might want to look into the animation callbacks:* onAnimationStart(%this)
* onFrameChange(%this, %frameIndex)
* onAnimationEnd(%this) //this is the one you probably are looking for
Torque Owner Don Schaper
XIX Software
function checkIfAnimationIsDone( %firstAnimation )
{
if ( %firstAnimation.getIsAnimationFinished() ) $secondAnimation.playAnimation( secondAnimationDatablock );
else schedule( 30, 0, "checkIfAnimationIsDone", %firstAnimation );
}
There are many ways to script this sort of thing; but the important thing is the "getIsAnimationFinished".