Hello Guest

Author Topic: Bug when getting tk2dAnimator.CurrentFrame  (Read 3398 times)

drkucho

  • 2D Toolkit
  • Jr. Member
  • *
  • Posts: 72
  • Retro Arcade Freak
    • View Profile
    • Dr. Kucho!
Bug when getting tk2dAnimator.CurrentFrame
« on: January 12, 2015, 04:20:29 pm »
i think i found a bug cause if the animation is finished playing it returns frame+1 , in other words i have a one frame animation and it returns 1 instad of 0

greets

unikronsoftware

  • Administrator
  • Hero Member
  • *****
  • Posts: 9709
    • View Profile
Re: Bug when getting tk2dAnimator.CurrentFrame
« Reply #1 on: January 13, 2015, 02:17:38 pm »
It was kinda intended to signify the difference between "playing the last frame" and "finished playing the last frame". I can see how that could be a problem though, you can change the behaviour in

Code: [Select]
public int CurrentFrame {
get {
switch (currentClip.wrapMode) {
case tk2dSpriteAnimationClip.WrapMode.Once:
return Mathf.Min((int)clipTime, currentClip.frames.Length - 1); // change this

What does everyone else think? I can change this but dont want to break existing code.