diff options
-rw-r--r-- | core/src/ch/asynk/tankontank/game/GameCtrl.java | 11 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Hud.java | 6 |
2 files changed, 14 insertions, 3 deletions
diff --git a/core/src/ch/asynk/tankontank/game/GameCtrl.java b/core/src/ch/asynk/tankontank/game/GameCtrl.java index 05e1ce0..c22629e 100644 --- a/core/src/ch/asynk/tankontank/game/GameCtrl.java +++ b/core/src/ch/asynk/tankontank/game/GameCtrl.java @@ -53,6 +53,17 @@ public class GameCtrl implements Disposable factory.dispose(); } + public boolean inAnimation() + { + return (state == animationState); + } + + public void animationDone() + { + hud.reset(); + setState(GameState.State.VIEW); + } + public void setState(GameState.State state) { switch(state) { diff --git a/core/src/ch/asynk/tankontank/game/Hud.java b/core/src/ch/asynk/tankontank/game/Hud.java index b4e7e50..26b986f 100644 --- a/core/src/ch/asynk/tankontank/game/Hud.java +++ b/core/src/ch/asynk/tankontank/game/Hud.java @@ -147,11 +147,11 @@ public class Hud implements Disposable public boolean touchDown(float x, float y) { - if (!rect.contains(x,y)) return false; + if (ctrl.inAnimation() || !rect.contains(x,y)) return false; if (cancelAct.hit(x, y)) { ctrl.abort(); - cancelAct.toggle(); + cancelAct.setOn(); } return true; @@ -159,7 +159,7 @@ public class Hud implements Disposable public boolean touchUp(float x, float y) { - if (!rect.contains(x,y)) return false; + if (ctrl.inAnimation() || !rect.contains(x,y)) return false; if (moveAct.hit(x, y)) { moveAct.setOn(); |