summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-06 16:34:13 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-06 16:34:13 +0200
commit2ac6629d3e1d52ab3743f7d05259beed7ed31d9b (patch)
tree44453c59fe8be4636fda16ecf6465cf980ce8562 /core/src
parent644c17b7639a9cacc84f0ddf56dd836bb27e233a (diff)
downloadRustAndDust-2ac6629d3e1d52ab3743f7d05259beed7ed31d9b.zip
RustAndDust-2ac6629d3e1d52ab3743f7d05259beed7ed31d9b.tar.gz
GameCtrl: add inAnimation() and animationDone()
Diffstat (limited to 'core/src')
-rw-r--r--core/src/ch/asynk/tankontank/game/GameCtrl.java11
-rw-r--r--core/src/ch/asynk/tankontank/game/Hud.java6
2 files changed, 14 insertions, 3 deletions
diff --git a/core/src/ch/asynk/tankontank/game/GameCtrl.java b/core/src/ch/asynk/tankontank/game/GameCtrl.java
index 05e1ce0..c22629e 100644
--- a/core/src/ch/asynk/tankontank/game/GameCtrl.java
+++ b/core/src/ch/asynk/tankontank/game/GameCtrl.java
@@ -53,6 +53,17 @@ public class GameCtrl implements Disposable
factory.dispose();
}
+ public boolean inAnimation()
+ {
+ return (state == animationState);
+ }
+
+ public void animationDone()
+ {
+ hud.reset();
+ setState(GameState.State.VIEW);
+ }
+
public void setState(GameState.State state)
{
switch(state) {
diff --git a/core/src/ch/asynk/tankontank/game/Hud.java b/core/src/ch/asynk/tankontank/game/Hud.java
index b4e7e50..26b986f 100644
--- a/core/src/ch/asynk/tankontank/game/Hud.java
+++ b/core/src/ch/asynk/tankontank/game/Hud.java
@@ -147,11 +147,11 @@ public class Hud implements Disposable
public boolean touchDown(float x, float y)
{
- if (!rect.contains(x,y)) return false;
+ if (ctrl.inAnimation() || !rect.contains(x,y)) return false;
if (cancelAct.hit(x, y)) {
ctrl.abort();
- cancelAct.toggle();
+ cancelAct.setOn();
}
return true;
@@ -159,7 +159,7 @@ public class Hud implements Disposable
public boolean touchUp(float x, float y)
{
- if (!rect.contains(x,y)) return false;
+ if (ctrl.inAnimation() || !rect.contains(x,y)) return false;
if (moveAct.hit(x, y)) {
moveAct.setOn();