From 246baa4946d2247a90f6a62f9683a2b103bea52c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Fri, 31 Oct 2014 22:58:09 +0100 Subject: Board: on animation first call removePawn(), at the end setPawnOnto() to ensure revert safety --- core/src/ch/asynk/tankontank/engine/Board.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) 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); -- cgit v1.1-2-g2b99