Hello Guest

Author Topic: TDToolKit Animator Addon  (Read 3003 times)

nadako

  • Newbie
  • *
  • Posts: 1
    • View Profile
TDToolKit Animator Addon
« on: July 02, 2014, 06:56:05 pm »
Can yall please add on a play in reverse please!? And can yall also add on a frame to stop on as well. Right now I have a sprite sheet that contains a ship rotating. So for turning right I would Start on Frame 0 and stop on Frame 5 or if I can I would play it in reverse in code and go from 5 to 0. Or better I would go from 0 - 13 but in reverse. I had already written this in code and it is now working in the game but I had to change up tk2ds source.

I added a state in the tk2dSpriteAnimationClips WrapMode OnceReverse

And then in the tk2dSpriteAnimator in the Update Animation function

            case tk2dSpriteAnimationClip.WrapMode.OnceReverse:
            {
                clipTime -= (deltaTime * clipFps * 2.0f);
                int currFrame = (int)clipTime;
                if (currFrame < 0)
                {
                    SetFrameInternal(CurrentClip.frames.Length - 1);
                    state &= ~State.Playing;
                    ProcessEvents(_previousFrame, currentClip.frames.Length - 1, 1);
                    OnAnimationCompleted();
                }
                else
                {
                    SetFrameInternal(currFrame);
                    ProcessEvents(_previousFrame, currFrame, -1);
                }
                break;
            }


Being Able to do this in code makes us programmers life a ton easier.