diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2018-10-17 16:04:05 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2018-10-17 16:04:05 +0200 |
commit | f5f6fbf750d3f7ffae72ef51b648eed7f0b6381b (patch) | |
tree | 2adfa0c05511f058957a3fde4f5f95f3ca62b939 | |
parent | a7522b9a4cfa9be0e0cb5f77dacd86bbf04765e7 (diff) | |
download | gdx-boardgame-f5f6fbf750d3f7ffae72ef51b648eed7f0b6381b.zip gdx-boardgame-f5f6fbf750d3f7ffae72ef51b648eed7f0b6381b.tar.gz |
AnimationScreen : test MoveAnimation
-rw-r--r-- | test/src/ch/asynk/gdx/boardgame/test/AnimationsScreen.java | 34 |
1 files changed, 34 insertions, 0 deletions
diff --git a/test/src/ch/asynk/gdx/boardgame/test/AnimationsScreen.java b/test/src/ch/asynk/gdx/boardgame/test/AnimationsScreen.java index cb26b5d..9c701e3 100644 --- a/test/src/ch/asynk/gdx/boardgame/test/AnimationsScreen.java +++ b/test/src/ch/asynk/gdx/boardgame/test/AnimationsScreen.java @@ -8,6 +8,8 @@ import com.badlogic.gdx.math.Vector2; import ch.asynk.gdx.boardgame.Camera; import ch.asynk.gdx.boardgame.Orientation; +import ch.asynk.gdx.boardgame.Path; +import ch.asynk.gdx.boardgame.Tile; import ch.asynk.gdx.boardgame.pieces.Piece; import ch.asynk.gdx.boardgame.boards.Board; import ch.asynk.gdx.boardgame.boards.BoardFactory; @@ -15,6 +17,7 @@ import ch.asynk.gdx.boardgame.ui.Alignment; import ch.asynk.gdx.boardgame.animations.AnimationSequence; import ch.asynk.gdx.boardgame.animations.BounceAnimation; import ch.asynk.gdx.boardgame.animations.DelayAnimation; +import ch.asynk.gdx.boardgame.animations.MoveAnimation; public class AnimationsScreen extends AbstractScreen { @@ -44,6 +47,37 @@ public class AnimationsScreen extends AbstractScreen animations = AnimationSequence.obtain(10); animations.add(BounceAnimation.obtain(panzer, 2f, 3f, -1)); animations.add(DelayAnimation.obtain(panzer, 1f)); + animations.add(MoveAnimation.obtain(panzer, buildPath(), 2f)); + animations.add(DelayAnimation.obtain(panzer, 1f)); + } + + private Path buildPath() + { + Vector2 v = new Vector2(); + Path path = Path.obtain(); + path.ensureCapacity(10); + board.centerOf(7, 4, v); + path.add(new Tile(v.x, v.y)); + board.centerOf(6, 4, v); + path.add(new Tile(v.x, v.y)); + board.centerOf(5, 3, v); + path.add(new Tile(v.x, v.y)); + board.centerOf(5, 2, v); + path.add(new Tile(v.x, v.y)); + board.centerOf(6, 2, v); + path.add(new Tile(v.x, v.y)); + board.centerOf(7, 2, v); + path.add(new Tile(v.x, v.y)); + board.centerOf(8, 3, v); + path.add(new Tile(v.x, v.y)); + board.centerOf(9, 4, v); + path.add(new Tile(v.x, v.y)); + board.centerOf(8, 4, v); + path.add(new Tile(v.x, v.y)); + board.centerOf(7, 4, v); + path.add(new Tile(v.x, v.y)); + path.setFinalOrientation(Orientation.NE); + return path; } @Override public void dispose() |