diff options
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Board.java | 4 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Pawn.java | 10 |
2 files changed, 6 insertions, 8 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java index 93274eb..b82c8c7 100644 --- a/core/src/ch/asynk/tankontank/engine/Board.java +++ b/core/src/ch/asynk/tankontank/engine/Board.java @@ -532,9 +532,7 @@ public abstract class Board implements Disposable protected Vector2 getPawnPosAt(Pawn pawn, GridPoint2 coords, Vector2 pos) { - // FIXME the pawn should return its Vector3 - Tile tile = getTile(coords); - return pawn.getPosAt(tile.getX(), tile.getY(), pos); + return pawn.getPosAt(getTile(coords.x, coords.y), pos); } public Pawn setPawnAt(Pawn pawn, GridPoint2 coords, Orientation o) diff --git a/core/src/ch/asynk/tankontank/engine/Pawn.java b/core/src/ch/asynk/tankontank/engine/Pawn.java index bde5f0c..f1626cc 100644 --- a/core/src/ch/asynk/tankontank/engine/Pawn.java +++ b/core/src/ch/asynk/tankontank/engine/Pawn.java @@ -131,14 +131,14 @@ public abstract class Pawn implements Moveable, Disposable return new Vector2(x, y); } - public Vector2 getPosAt(float x, float y, Vector2 pos) + public Vector2 getPosAt(Tile tile, Vector2 pos) { - float cx = (x - (image.getWidth() / 2f)); - float cy = (y - (image.getHeight() / 2f)); + float x = (tile.getX() - (image.getWidth() / 2f)); + float y = (tile.getY() - (image.getHeight() / 2f)); if (pos == null) - return new Vector2(cx, cy); + return new Vector2(x, y); else - pos.set(cx, cy); + pos.set(x, y); return pos; } |