summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-31 22:58:09 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-31 22:58:09 +0100
commit246baa4946d2247a90f6a62f9683a2b103bea52c (patch)
tree19c22b6f6af4ce3ccd486fa8a7b94a5b38033916 /core
parentbb042480e91388ebff166efb9b609c5a1e86af87 (diff)
downloadRustAndDust-246baa4946d2247a90f6a62f9683a2b103bea52c.zip
RustAndDust-246baa4946d2247a90f6a62f9683a2b103bea52c.tar.gz
Board: on animation first call removePawn(), at the end setPawnOnto() to ensure revert safety
Diffstat (limited to 'core')
-rw-r--r--core/src/ch/asynk/tankontank/engine/Board.java10
1 files changed, 9 insertions, 1 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java
index 6707b21..28e94ea 100644
--- a/core/src/ch/asynk/tankontank/engine/Board.java
+++ b/core/src/ch/asynk/tankontank/engine/Board.java
@@ -381,7 +381,15 @@ public abstract class Board implements Disposable
protected void rotatePawn(final Pawn pawn, Orientation o, RunnableAnimation whenDone)
{
- AnimationSequence seq = pawn.getRotateAnimation(o.r(), 1);
+ removePawn(pawn);
+
+ AnimationSequence seq = pawn.getRotateAnimation(o.r(), 2);
+ seq.addAnimation(RunnableAnimation.get(pawn, new Runnable() {
+ @Override
+ public void run() {
+ setPawnOnto(pawn, pawn.getTile(), pawn.getRotation());
+ }
+ }));
seq.addAnimation(whenDone);
addAnimation(seq);
pawn.rotate(o);