diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-22 14:31:57 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-22 14:31:57 +0200 |
commit | 85a9405f4b9b1f8e68636fbd5c1cbbdf34843d19 (patch) | |
tree | db87394fe8512f7e6fa3e4ae9e352f59212a3445 /core/src | |
parent | 86597d8e9f872418bfe547ada30d6943fdbb8c90 (diff) | |
download | RustAndDust-85a9405f4b9b1f8e68636fbd5c1cbbdf34843d19.zip RustAndDust-85a9405f4b9b1f8e68636fbd5c1cbbdf34843d19.tar.gz |
Pawn: add setOnTile(Tile, Orientation)
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Board.java | 3 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Pawn.java | 7 |
2 files changed, 8 insertions, 2 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java index aa58bab..026dd71 100644 --- a/core/src/ch/asynk/tankontank/engine/Board.java +++ b/core/src/ch/asynk/tankontank/engine/Board.java @@ -522,8 +522,7 @@ public abstract class Board implements Disposable public Pawn setPawnAt(Pawn pawn, GridPoint2 coords, Orientation o) { - Vector2 pos = getPawnPosAt(pawn, coords, null); - pawn.setPosition(pos.x, pos.y, o.r()); + pawn.setOnTile(getTile(coords.x, coords.y), o); pushPawnAt(pawn, coords); return pawn; } diff --git a/core/src/ch/asynk/tankontank/engine/Pawn.java b/core/src/ch/asynk/tankontank/engine/Pawn.java index f1626cc..35973fb 100644 --- a/core/src/ch/asynk/tankontank/engine/Pawn.java +++ b/core/src/ch/asynk/tankontank/engine/Pawn.java @@ -142,6 +142,13 @@ public abstract class Pawn implements Moveable, Disposable return pos; } + public void setOnTile(Tile tile, Orientation o) + { + float x = (tile.getX() - (image.getWidth() / 2f)); + float y = (tile.getY() - (image.getHeight() / 2f)); + setPosition(x, y, o.r()); + } + @Override public float getX() { |