diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Hud.java | 24 |
1 files changed, 14 insertions, 10 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Hud.java b/core/src/ch/asynk/tankontank/game/Hud.java index 2f0e0c6..c9e47ab 100644 --- a/core/src/ch/asynk/tankontank/game/Hud.java +++ b/core/src/ch/asynk/tankontank/game/Hud.java @@ -31,6 +31,16 @@ class ActionBtn implements Disposable enabled = !enabled; } + public void setOn() + { + enabled = true; + } + + public void setOff() + { + enabled = false; + } + public Image getImage() { return (enabled ? on : off); @@ -129,13 +139,7 @@ public class Hud implements Disposable { if (!rect.contains(x,y)) return false; - if (moveAct.hit(x, y)) { - moveAct.toggle(); - } else if (rotateAct.hit(x, y)) { - rotateAct.toggle(); - } else if (attackAct.hit(x, y)) { - attackAct.toggle(); - } else if (cancelAct.hit(x, y)) { + if (cancelAct.hit(x, y)) { cancelAct.toggle(); } @@ -147,11 +151,11 @@ public class Hud implements Disposable if (!rect.contains(x,y)) return false; if (moveAct.hit(x, y)) { - moveAct.toggle(); + moveAct.setOn(); } else if (rotateAct.hit(x, y)) { - rotateAct.toggle(); + rotateAct.setOn(); } else if (attackAct.hit(x, y)) { - attackAct.toggle(); + attackAct.setOn(); } else if (cancelAct.hit(x, y)) { cancelAct.toggle(); } |