From 756f0fd3d327dc8e114dfcf7fa41db9bcce416d3 Mon Sep 17 00:00:00 2001 From: Jonathan Hager Date: Sat, 19 Dec 2020 21:46:57 +0100 Subject: [PATCH] Animation length is now used correctly --- core/src/com/trs/main/AnimatedSprite.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/core/src/com/trs/main/AnimatedSprite.java b/core/src/com/trs/main/AnimatedSprite.java index ee07396..5b23bbd 100644 --- a/core/src/com/trs/main/AnimatedSprite.java +++ b/core/src/com/trs/main/AnimatedSprite.java @@ -11,6 +11,8 @@ import com.badlogic.gdx.graphics.g2d.TextureRegion; */ public class AnimatedSprite { + private final static int[] rowLengths = {7, 7, 7, 7, 8, 8, 8, 8, 9, 9, 9, 9, 6, 6, 6, 12, 12, 12, 12, 6}; + private Sprite sprite; private TextureRegion[][] texture; private int frame; @@ -32,7 +34,7 @@ public class AnimatedSprite { if(this.delta >= 0.1f) { this.delta = 0; - if(getFrame() >= texture[getRow()].length - 1){ + if(getFrame() >= rowLengths[getRow()] - 1){ setFrame(0); } else{