summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/tankontank/game/GameCtrl.java4
-rw-r--r--core/src/ch/asynk/tankontank/game/Hud.java4
-rw-r--r--core/src/ch/asynk/tankontank/screens/GameScreen.java20
3 files changed, 16 insertions, 12 deletions
diff --git a/core/src/ch/asynk/tankontank/game/GameCtrl.java b/core/src/ch/asynk/tankontank/game/GameCtrl.java
index c22629e..d662f0a 100644
--- a/core/src/ch/asynk/tankontank/game/GameCtrl.java
+++ b/core/src/ch/asynk/tankontank/game/GameCtrl.java
@@ -53,9 +53,9 @@ public class GameCtrl implements Disposable
factory.dispose();
}
- public boolean inAnimation()
+ public boolean mayProcessTouch()
{
- return (state == animationState);
+ return (state != animationState);
}
public void animationDone()
diff --git a/core/src/ch/asynk/tankontank/game/Hud.java b/core/src/ch/asynk/tankontank/game/Hud.java
index 26b986f..e781305 100644
--- a/core/src/ch/asynk/tankontank/game/Hud.java
+++ b/core/src/ch/asynk/tankontank/game/Hud.java
@@ -147,7 +147,7 @@ public class Hud implements Disposable
public boolean touchDown(float x, float y)
{
- if (ctrl.inAnimation() || !rect.contains(x,y)) return false;
+ if (!rect.contains(x,y)) return false;
if (cancelAct.hit(x, y)) {
ctrl.abort();
@@ -159,7 +159,7 @@ public class Hud implements Disposable
public boolean touchUp(float x, float y)
{
- if (ctrl.inAnimation() || !rect.contains(x,y)) return false;
+ if (!rect.contains(x,y)) return false;
if (moveAct.hit(x, y)) {
moveAct.setOn();
diff --git a/core/src/ch/asynk/tankontank/screens/GameScreen.java b/core/src/ch/asynk/tankontank/screens/GameScreen.java
index e3f6a65..696cfd1 100644
--- a/core/src/ch/asynk/tankontank/screens/GameScreen.java
+++ b/core/src/ch/asynk/tankontank/screens/GameScreen.java
@@ -112,10 +112,12 @@ public class GameScreen implements Screen
{
if (button == Input.Buttons.LEFT) {
dragPos.set(x, y);
- unprojectToHud(x, y, touchPos);
- if (!ctrl.hud.touchDown(touchPos.x, touchPos.y)) {
- unprojectToMap(x, y, touchPos);
- ctrl.touchDown(touchPos.x, touchPos.y);
+ if (ctrl.mayProcessTouch()) {
+ unprojectToHud(x, y, touchPos);
+ if (!ctrl.hud.touchDown(touchPos.x, touchPos.y)) {
+ unprojectToMap(x, y, touchPos);
+ ctrl.touchDown(touchPos.x, touchPos.y);
+ }
}
}
@@ -125,10 +127,12 @@ public class GameScreen implements Screen
public boolean touchUp(int x, int y, int pointer, int button)
{
if (button == Input.Buttons.LEFT) {
- unprojectToHud(x, y, touchPos);
- if (!ctrl.hud.touchUp(touchPos.x, touchPos.y)) {
- unprojectToMap(x, y, touchPos);
- ctrl.touchUp(touchPos.x, touchPos.y);
+ if (ctrl.mayProcessTouch()) {
+ unprojectToHud(x, y, touchPos);
+ if (!ctrl.hud.touchUp(touchPos.x, touchPos.y)) {
+ unprojectToMap(x, y, touchPos);
+ ctrl.touchUp(touchPos.x, touchPos.y);
+ }
}
}
return true;