diff options
-rw-r--r-- | core/src/ch/asynk/tankontank/game/GameCtrl.java | 5 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Hud.java | 17 |
2 files changed, 15 insertions, 7 deletions
diff --git a/core/src/ch/asynk/tankontank/game/GameCtrl.java b/core/src/ch/asynk/tankontank/game/GameCtrl.java index d662f0a..1d7f92e 100644 --- a/core/src/ch/asynk/tankontank/game/GameCtrl.java +++ b/core/src/ch/asynk/tankontank/game/GameCtrl.java @@ -58,6 +58,11 @@ public class GameCtrl implements Disposable return (state != animationState); } + public boolean isInAction() + { + return (state != viewState); + } + public void animationDone() { hud.reset(); diff --git a/core/src/ch/asynk/tankontank/game/Hud.java b/core/src/ch/asynk/tankontank/game/Hud.java index e86bcbc..9297bde 100644 --- a/core/src/ch/asynk/tankontank/game/Hud.java +++ b/core/src/ch/asynk/tankontank/game/Hud.java @@ -180,13 +180,16 @@ public class Hud implements Disposable { if (!rect.contains(x,y)) return false; - if (moveAct.hit(x, y)) { - switchTo(GameState.State.MOVE); - } else if (rotateAct.hit(x, y)) { - switchTo(GameState.State.ROTATE); - } else if (attackAct.hit(x, y)) { - // switchTo(GameState.State.ATTACK); - } else if (cancelAct.hit(x, y)) { + if (!ctrl.isInAction()) { + if (moveAct.hit(x, y)) { + switchTo(GameState.State.MOVE); + } else if (rotateAct.hit(x, y)) { + switchTo(GameState.State.ROTATE); + } else if (attackAct.hit(x, y)) { + // switchTo(GameState.State.ATTACK); + } + } + if (cancelAct.hit(x, y)) { reset(); ctrl.abort(); } |