summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/src/ch/asynk/tankontank/engine/HeadedPawn.java6
-rw-r--r--core/src/ch/asynk/tankontank/engine/Pawn.java9
2 files changed, 10 insertions, 5 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/HeadedPawn.java b/core/src/ch/asynk/tankontank/engine/HeadedPawn.java
index 427d61f..affe98b 100644
--- a/core/src/ch/asynk/tankontank/engine/HeadedPawn.java
+++ b/core/src/ch/asynk/tankontank/engine/HeadedPawn.java
@@ -45,9 +45,9 @@ public abstract class HeadedPawn extends Pawn
public void setPosition(float x, float y, float z)
{
super.setPosition(x, y);
- float cx = x + (getWidth() / 2f) - (head.getWidth() / 2f);
- float cy = y + (getHeight() / 2f) - (head.getHeight() / 2f);
- head.setPosition(cx, cy);
+ float cx = x + (getWidth() / 2f);
+ float cy = y + (getHeight() / 2f);
+ head.centerOn(cx, cy);
head.setRotation(z);
this.orientation = Board.Orientation.fromRotation(z);
}
diff --git a/core/src/ch/asynk/tankontank/engine/Pawn.java b/core/src/ch/asynk/tankontank/engine/Pawn.java
index b669bb7..8c39310 100644
--- a/core/src/ch/asynk/tankontank/engine/Pawn.java
+++ b/core/src/ch/asynk/tankontank/engine/Pawn.java
@@ -118,14 +118,19 @@ public abstract class Pawn extends Image implements Disposable
public void setPosition(float x, float y)
{
super.setPosition(x, y);
- overlays.setPosition(x, y);
+ float cx = x + (getWidth() / 2f);
+ float cy = y + (getHeight() / 2f);
+ overlays.centerOn(cx, cy);
}
@Override
public void setPosition(float x, float y, float z)
{
super.setPosition(x, y, z);
- overlays.setPosition(x, y, z);
+ float cx = x + (getWidth() / 2f);
+ float cy = y + (getHeight() / 2f);
+ overlays.centerOn(cx, cy);
+ overlays.setRotation(z);
}
@Override