summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-22 12:15:54 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-22 12:15:54 +0200
commitcbd3855d120cfc9e50c5431d48430df54efc570d (patch)
tree124f6ed46aea22974829561169b739f1eb1912c5 /core/src
parentc3d3d2132324fed57e7d6ab6ec11eb588216fae7 (diff)
downloadRustAndDust-cbd3855d120cfc9e50c5431d48430df54efc570d.zip
RustAndDust-cbd3855d120cfc9e50c5431d48430df54efc570d.tar.gz
Bawn,Board: simplify getPawnPosAt(...)
Diffstat (limited to 'core/src')
-rw-r--r--core/src/ch/asynk/tankontank/engine/Board.java4
-rw-r--r--core/src/ch/asynk/tankontank/engine/Pawn.java10
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;
}