From c6756d41ed2861bfd802df097401bdd01e39bf19 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Thu, 25 Sep 2014 11:19:34 +0200 Subject: HeadePawn: add protected Board.Orientation orientation --- core/src/ch/asynk/tankontank/engine/HeadedPawn.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/src/ch/asynk/tankontank/engine/HeadedPawn.java b/core/src/ch/asynk/tankontank/engine/HeadedPawn.java index 36eb2a2..427d61f 100644 --- a/core/src/ch/asynk/tankontank/engine/HeadedPawn.java +++ b/core/src/ch/asynk/tankontank/engine/HeadedPawn.java @@ -12,11 +12,13 @@ import com.badlogic.gdx.math.Vector3; public abstract class HeadedPawn extends Pawn { private Image head; + protected Board.Orientation orientation; public HeadedPawn(TextureRegion region, TextureRegion head, TextureAtlas atlas) { super(region, atlas); this.head = new Image(head); + this.orientation = Board.Orientation.KEEP; } @Override @@ -29,7 +31,7 @@ public abstract class HeadedPawn extends Pawn @Override public float getRotation() { - return head.getRotation(); + return orientation.r(); } @Override @@ -47,6 +49,7 @@ public abstract class HeadedPawn extends Pawn float cy = y + (getHeight() / 2f) - (head.getHeight() / 2f); head.setPosition(cx, cy); head.setRotation(z); + this.orientation = Board.Orientation.fromRotation(z); } @Override -- cgit v1.1-2-g2b99