summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-10 15:30:34 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-10 15:30:34 +0200
commit27c4e7089df3c91f86da1ce841910a23528a0dcf (patch)
treea824f50f085f697cfeb12fca5db7f2f64c15dace /core/src/ch/asynk/tankontank
parent4ce95587bd59b65e15859ee55fbd5b9d2cfaa238 (diff)
downloadRustAndDust-27c4e7089df3c91f86da1ce841910a23528a0dcf.zip
RustAndDust-27c4e7089df3c91f86da1ce841910a23528a0dcf.tar.gz
GameCtrl: add animationCount and setAnnimationCount(int)
Diffstat (limited to 'core/src/ch/asynk/tankontank')
-rw-r--r--core/src/ch/asynk/tankontank/game/GameCtrl.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/core/src/ch/asynk/tankontank/game/GameCtrl.java b/core/src/ch/asynk/tankontank/game/GameCtrl.java
index 6202ef4..149596c 100644
--- a/core/src/ch/asynk/tankontank/game/GameCtrl.java
+++ b/core/src/ch/asynk/tankontank/game/GameCtrl.java
@@ -44,6 +44,8 @@ public class GameCtrl implements Disposable
private GameState rotateState;
private GameState animationState;
+ private int animationCount = 0;
+
private GameState state;
public GameCtrl(final TankOnTank game)
@@ -85,11 +87,19 @@ public class GameCtrl implements Disposable
return (state != selectState);
}
+ public void setAnimationCount(int count)
+ {
+ animationCount = count;
+ }
+
public void animationDone()
{
- GameState.State next = state.getNextState();
- state.setNextState(GameState.State.SELECT);
- setState(next, (next == GameState.State.SELECT));
+ animationCount -= 1;
+ if (animationCount == 0) {
+ GameState.State next = state.getNextState();
+ state.setNextState(GameState.State.SELECT);
+ setState(next, (next == GameState.State.SELECT));
+ }
}
public void setState(GameState.State state)