Skip to content

Commit c286e35

Browse files
committed
fix animationFrame to big
1 parent 7ad97b3 commit c286e35

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/org/openpatch/scratch/extensions/animation/AnimatedSprite.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,9 @@ public void playAnimation(String name, boolean once) {
5757
if (this.getTimer("animation").everyMillis(animationInterval)) {
5858
String[] animation = animations.get(name);
5959
if (!animationPlayed && animationFrame != animation.length - 1 || !once) {
60+
if (animationFrame >= animation.length) {
61+
animationFrame = 0;
62+
}
6063
this.switchCostume(animation[animationFrame]);
6164
animationFrame = (animationFrame + 1) % animation.length;
6265
} else {

0 commit comments

Comments
 (0)