summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch/asynk/tankontank')
-rw-r--r--core/src/ch/asynk/tankontank/engine/Pawn.java34
1 files changed, 11 insertions, 23 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Pawn.java b/core/src/ch/asynk/tankontank/engine/Pawn.java
index 6fe1540..9a2fcc1 100644
--- a/core/src/ch/asynk/tankontank/engine/Pawn.java
+++ b/core/src/ch/asynk/tankontank/engine/Pawn.java
@@ -166,44 +166,32 @@ public abstract class Pawn implements Drawable, Disposable
public AnimationSequence getRotateAnimation(Vector3 v)
{
+ prevPosition.set(position);
AnimationSequence seq = AnimationSequence.get(2);
seq.addAnimation(MoveToAnimation.get(this, v, MOVE_TIME));
return seq;
}
- public AnimationSequence getRevertLastMoveAnimation()
+ public AnimationSequence getMoveAnimation(ArrayList<Vector3> path)
{
- AnimationSequence seq = AnimationSequence.get(4);
- seq.addAnimation(MoveToAnimation.get(this, prevPosition, MOVE_TIME));
- seq.addAnimation(RunnableAnimation.get(this, new Runnable() {
- @Override
- public void run() {
- revertPosition();
- setPosition(position.x, position.y, position.z);
- }
- }));
+ prevPosition.set(position);
+ AnimationSequence seq = AnimationSequence.get(path.size() + 2);
+ for (Vector3 v : path)
+ seq.addAnimation(MoveToAnimation.get(this, v, MOVE_TIME));
return seq;
}
- public AnimationSequence getMoveAnimation(ArrayList<Vector3> path)
+ public AnimationSequence getRevertLastMoveAnimation()
{
- prevPosition.set(position);
-
- int s = path.size();
- final Vector3 finalPos = path.get(s - 1);
-
- AnimationSequence seq = AnimationSequence.get(s + 3);
-
- for (Vector3 v : path) {
- seq.addAnimation(MoveToAnimation.get(this, v, MOVE_TIME));
- }
-
+ AnimationSequence seq = AnimationSequence.get(4);
+ seq.addAnimation(MoveToAnimation.get(this, prevPosition, MOVE_TIME));
seq.addAnimation(RunnableAnimation.get(this, new Runnable() {
@Override
public void run() {
- setPosition(finalPos.x, finalPos.y, finalPos.z);
+ revertPosition();
+ setPosition(position.x, position.y, position.z);
}
}));