2D Toolkit Forum
2D Toolkit => Support => Topic started by: mike2d on July 03, 2012, 05:26:55 pm
-
hi,
i'd like to play an animation automatically when a previous one is finished ?
i've seen AnimationCompleteDelegate and Trigger options in the SpriteAnimation Inspector so what are they used for and what's the best way to accomplish what i explained above ?
-
The easiest way to do this is to hook up an AnimationCompleteDelegate and automatically call Play() from within the delegate. demo "5 - animation" shows how you can hook up an animation event delegate - the animationCompleteDelegate is very similar -
animSprite.animationCompleteDelegate = AnimationComplete;
void AnimationComplete(tk2dAnimatedSprite sprite, int clipId)
{
switch (clipId)
{
case 0: sprite.Play("NextClip"); break;
...
}
}
-
thanks