From f5f6fbf750d3f7ffae72ef51b648eed7f0b6381b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Wed, 17 Oct 2018 16:04:05 +0200 Subject: AnimationScreen : test MoveAnimation --- .../asynk/gdx/boardgame/test/AnimationsScreen.java | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) 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() -- cgit v1.1-2-g2b99