diff options
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Ctrl.java | 10 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Map.java | 10 |
2 files changed, 13 insertions, 7 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Ctrl.java b/core/src/ch/asynk/tankontank/game/Ctrl.java index a54deaf..cf08d3f 100644 --- a/core/src/ch/asynk/tankontank/game/Ctrl.java +++ b/core/src/ch/asynk/tankontank/game/Ctrl.java @@ -113,10 +113,12 @@ public class Ctrl implements Disposable { animationCount -= 1; if (animationCount == 0) { - map.animationsDone(); - StateType tmp = stateAfterAnimation; - stateAfterAnimation = StateType.DONE; - setState(tmp); + animationCount = map.animationsDone(); + if (animationCount == 0) { + StateType tmp = stateAfterAnimation; + stateAfterAnimation = StateType.DONE; + setState(tmp); + } } if (animationCount < 0) TankOnTank.debug(" animationCount < 0"); diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java index 1209652..7d3cba3 100644 --- a/core/src/ch/asynk/tankontank/game/Map.java +++ b/core/src/ch/asynk/tankontank/game/Map.java @@ -188,12 +188,15 @@ public abstract class Map extends Board activatedUnits.clear(); } - public void animationsDone() + public int animationsDone() { ShotAnimation.resetAll(); - if (animationClosure != null) + if (animationClosure != null) { addAnimation(animationClosure); - animationClosure = null; + animationClosure = null; + return 1; + } + return 0; } // ACTIONS @@ -374,6 +377,7 @@ public abstract class Map extends Board public void run() { objectives.unclaim(target.getHex()); removePawn(target); + animationDone(); } }); } |