diff options
6 files changed, 19 insertions, 5 deletions
diff --git a/core/src/ch/asynk/gdx/boardgame/Piece.java b/core/src/ch/asynk/gdx/boardgame/Piece.java index 275ea58..43bef04 100644 --- a/core/src/ch/asynk/gdx/boardgame/Piece.java +++ b/core/src/ch/asynk/gdx/boardgame/Piece.java @@ -18,6 +18,8 @@ import ch.asynk.gdx.boardgame.Tile; public class Piece extends Sprite implements Drawable, Positionable, Rotable, Scalable { + public static int angleCorrection = 0; + public Piece(Texture texture) { super(texture); @@ -77,4 +79,14 @@ public class Piece extends Sprite implements Drawable, Positionable, Rotable, Sc float h = getHeight(); shapeRenderer.rect(getX(), getY(), (w / 2f), (h / 2f), w, h, getScaleX(), getScaleY(), getRotation()); } + + @Override public void setRotation(float r) + { + super.setRotation(r - angleCorrection); + } + + @Override public float getRotation() + { + return super.getRotation() + angleCorrection; + } } diff --git a/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java b/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java index 688e1a0..5d7e401 100644 --- a/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java +++ b/core/src/ch/asynk/gdx/boardgame/boards/HexBoard.java @@ -39,8 +39,8 @@ public class HexBoard implements Board // [0] is 0° facing East // [8] is default - private static final int [] vAngles = {-90, -30, -1, 30, 90, 150, -1, 210, -30}; - private static final int [] hAngles = { -1, -60, 0, 60, -1, 120, 180, 240, -60}; + private static final int [] vAngles = { 0, 60, -1, 120, 180, 240, -1, 300, 60}; + private static final int [] hAngles = { -1, 30, 90, 150, -1, 210, 270, 330, 30}; public HexBoard(int cols, int rows, float side, float x0, float y0, BoardFactory.BoardOrientation boardOrientation) { diff --git a/core/src/ch/asynk/gdx/boardgame/boards/SquareBoard.java b/core/src/ch/asynk/gdx/boardgame/boards/SquareBoard.java index 7e381e9..f7df4ff 100644 --- a/core/src/ch/asynk/gdx/boardgame/boards/SquareBoard.java +++ b/core/src/ch/asynk/gdx/boardgame/boards/SquareBoard.java @@ -12,7 +12,7 @@ public class SquareBoard implements Board // [0] is 0° facing East // [8] is default - private static final int [] angles = {0, -1, 90, -1, 180, -1, 270, -1, 0, 90}; + private static final int [] angles = {0, -1, 90, -1, 180, -1, 270, -1, 90}; public SquareBoard(int cols, int rows, float side, float x0, float y0) { diff --git a/core/src/ch/asynk/gdx/boardgame/boards/TriangleBoard.java b/core/src/ch/asynk/gdx/boardgame/boards/TriangleBoard.java index 2ea7237..dfbd42d 100644 --- a/core/src/ch/asynk/gdx/boardgame/boards/TriangleBoard.java +++ b/core/src/ch/asynk/gdx/boardgame/boards/TriangleBoard.java @@ -20,8 +20,8 @@ public class TriangleBoard implements Board // [0] is 0° facing East // [8] is default - private static final int [] vAngles = {-1, 30, 90, 150, -1, 210, 270, 330, 30}; - private static final int [] hAngles = { 0, 60, -1, 120, 180, 240, -1, 300, 60}; + private static final int [] vAngles = { 0, 60, -1, 120, 180, 240, -1, 300, 0}; + private static final int [] hAngles = { -1, 30, 90, 150, -1, 210, 270, 330, 30}; public TriangleBoard(int cols, int rows, float side, float x0, float y0, BoardFactory.BoardOrientation boardOrientation) { diff --git a/test/src/ch/asynk/gdx/boardgame/test/AnimationsScreen.java b/test/src/ch/asynk/gdx/boardgame/test/AnimationsScreen.java index 501b00c..4013273 100644 --- a/test/src/ch/asynk/gdx/boardgame/test/AnimationsScreen.java +++ b/test/src/ch/asynk/gdx/boardgame/test/AnimationsScreen.java @@ -44,6 +44,7 @@ public class AnimationsScreen extends AbstractScreen this.board = BoardFactory.getBoard(0, 0, BoardFactory.BoardType.HEX, 110, 50, 103, BoardFactory.BoardOrientation.VERTICAL); this.camera = this.cam = new Camera(10, map.getWidth(), map.getHeight(), 1.0f, 0.3f, false); + Piece.angleCorrection = 90; this.panzer = getPiece(app, 7, 4, Orientation.NW, app.assets.PANZER, 1f); this.other0 = getPiece(app, 9, 5, Orientation.SW, app.assets.PANZER, 0f); this.other1 = getPiece(app, 3, 1, Orientation.NE, app.assets.PANZER, 0f); diff --git a/test/src/ch/asynk/gdx/boardgame/test/BoardScreen.java b/test/src/ch/asynk/gdx/boardgame/test/BoardScreen.java index 8bf1d50..4fb9e6d 100644 --- a/test/src/ch/asynk/gdx/boardgame/test/BoardScreen.java +++ b/test/src/ch/asynk/gdx/boardgame/test/BoardScreen.java @@ -37,6 +37,7 @@ public class BoardScreen extends AbstractScreen this.assets = assets; this.pos = new Vector2(); this.v = new Vector2(); + Piece.angleCorrection = 90; this.panzer = new Piece(assets.getTexture(assets.PANZER)); } |