diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-06 19:54:43 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-06 19:54:43 +0200 |
commit | 8b6d67fb0e7b6e27955af30cc3e5545d94689e55 (patch) | |
tree | 03013dcc6937b70f312a192af422d93dcd16f3be /core/src/ch/asynk/tankontank | |
parent | b270b931616fbe81b82fe98915958cb655d062f3 (diff) | |
download | RustAndDust-8b6d67fb0e7b6e27955af30cc3e5545d94689e55.zip RustAndDust-8b6d67fb0e7b6e27955af30cc3e5545d94689e55.tar.gz |
Hud: only accept buttons if not in Action
Diffstat (limited to 'core/src/ch/asynk/tankontank')
-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(); } |