Hello Guest

Author Topic: Sequencing Sprite Animations  (Read 3395 times)

tyrannosaur_jet

  • 2D Toolkit
  • Newbie
  • *
  • Posts: 5
    • View Profile
Sequencing Sprite Animations
« on: November 28, 2012, 06:33:50 pm »
Is there a way to sequence sprite animations, in much the same way as you would sequence different tweens in HOTween? I'm coming from Cocos2D, where there's a way to define a sequence where a sprite would play animation A and wait for it to finish before playing animation B (or delaying, or calling a method, tweening, etc.) I mentioned HOTween because you've suggested it before for other sprite properties on this forum, and because it has that same sort of sequencing built in; if there's a way to get tk2d sprite animations integrated with that, that would be great.

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Sequencing Sprite Animations
« Reply #1 on: November 28, 2012, 11:36:09 pm »
You could do it using the animation complete delegate...

Check the tk2dDemoAnimController.cs,
Code: [Select]
animSprite.animationCompleteDelegate = delegate(tk2dAnimatedSprite sprite, int clipId)
{
animSprite.Play("demo_pingpong");
animSprite.animationCompleteDelegate = null;
};
That plays "demo_once", and as soon as it is complete it plays "demo_pingpong". Is that the sort of thing you're looking for?