summaryrefslogtreecommitdiffstats
path: root/core/src/ch
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-03 11:43:24 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-03 11:43:24 +0200
commit7e789d4438fd4a78285bdda0e9e33fe6f9645454 (patch)
tree6ca08413018aa65efdcb3a415702eb1b94edcb6b /core/src/ch
parent93228ad6e320029b2e2eaba468e7e77604a6bcdb (diff)
downloadRustAndDust-7e789d4438fd4a78285bdda0e9e33fe6f9645454.zip
RustAndDust-7e789d4438fd4a78285bdda0e9e33fe6f9645454.tar.gz
Pawn: add AnimationSequence getMoveAnimation(Vector<Vector3> path)
Diffstat (limited to 'core/src/ch')
-rw-r--r--core/src/ch/asynk/tankontank/engine/Pawn.java21
1 files changed, 21 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Pawn.java b/core/src/ch/asynk/tankontank/engine/Pawn.java
index 582fbfd..d49e83f 100644
--- a/core/src/ch/asynk/tankontank/engine/Pawn.java
+++ b/core/src/ch/asynk/tankontank/engine/Pawn.java
@@ -90,6 +90,27 @@ public abstract class Pawn extends Image implements Disposable
return seq;
}
+ public AnimationSequence getMoveAnimation(Vector<Vector3> path)
+ {
+ int s = path.size();
+ final Vector3 finalPos = path.get(s - 1);
+
+ AnimationSequence seq = AnimationSequence.get(s + 1);
+
+ for (Vector3 v : path) {
+ seq.addAnimation(MoveToAnimation.get(this, v, MOVE_TIME));
+ }
+
+ seq.addAnimation(RunnableAnimation.get(this, new Runnable() {
+ @Override
+ public void run() {
+ moves.push(finalPos);
+ }
+ }));
+
+ return seq;
+ }
+
public boolean hasOverlayEnabled()
{
return overlays.isEnabled();