summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank/game
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-06 07:30:17 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-06 07:30:17 +0200
commitddab8eb00c9bf89935d495b1a58ae2c44cb20506 (patch)
tree852a2ebd216412540407fa4dd63c92c0337b5293 /core/src/ch/asynk/tankontank/game
parent4d5f97ca77beb1bca305168013132cfed83d1b18 (diff)
downloadRustAndDust-ddab8eb00c9bf89935d495b1a58ae2c44cb20506.zip
RustAndDust-ddab8eb00c9bf89935d495b1a58ae2c44cb20506.tar.gz
Hud: add setOn setOff to ActionBtn
Diffstat (limited to 'core/src/ch/asynk/tankontank/game')
-rw-r--r--core/src/ch/asynk/tankontank/game/Hud.java24
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();
}