Explorar o código

fix Anim not work when set frames in a later time. (#207)

LouisSong %!s(int64=8) %!d(string=hai) anos
pai
achega
fd2f808831
Modificáronse 1 ficheiros con 4 adicións e 1 borrados
  1. 4 1
      h2d/Anim.hx

+ 4 - 1
h2d/Anim.hx

@@ -53,7 +53,10 @@ class Anim extends Drawable {
 		if( curFrame < frames.length )
 			return;
 		if( loop ) {
-			curFrame %= frames.length;
+			if( frames.length == 0 )
+				curFrame = 0;
+			else
+				curFrame %= frames.length;
 			onAnimEnd();
 		} else if( curFrame >= frames.length ) {
 			curFrame = frames.length;