diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-02 23:46:16 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-02 23:46:16 +0200 |
commit | 342c6cf9f5681760d713e6a57a92b472f4761a95 (patch) | |
tree | 1f94b0df02df533eec5423578a26f00e40395dc8 /core/src | |
parent | fd33d6367e23e7fb583dba78b9cde08dd2cb4b9d (diff) | |
download | RustAndDust-342c6cf9f5681760d713e6a57a92b472f4761a95.zip RustAndDust-342c6cf9f5681760d713e6a57a92b472f4761a95.tar.gz |
Pawn,HeadedPaw: use StackedImage.centerOn(float, float) not setPosition(...)
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/HeadedPawn.java | 6 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Pawn.java | 9 |
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 |