summaryrefslogtreecommitdiffstats
path: root/core/src/ch
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch')
-rw-r--r--core/src/ch/asynk/tankontank/engine/Board.java16
-rw-r--r--core/src/ch/asynk/tankontank/engine/Tile.java5
2 files changed, 8 insertions, 13 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java
index 0166840..a923fb4 100644
--- a/core/src/ch/asynk/tankontank/engine/Board.java
+++ b/core/src/ch/asynk/tankontank/engine/Board.java
@@ -399,15 +399,6 @@ public abstract class Board extends Image implements Disposable
return n;
}
- public Vector2 getHexCenterAt(GridPoint2 tile)
- {
- // FIXME could ask it to the Tile
- float x = cfg.x0 + ((tile.x * cfg.w) + (cfg.w / 2));
- float y = cfg.y0 + ((tile.y * cfg.h) + (cfg.s / 2));
- if ((tile.y % 2) == 1) x += cfg.dw;
- return new Vector2(x, y);
- }
-
public Vector2 getPawnPosAt(Pawn pawn, GridPoint2 tile)
{
return getPawnPosAt(pawn, tile.x, tile.y);
@@ -415,10 +406,9 @@ public abstract class Board extends Image implements Disposable
private Vector2 getPawnPosAt(Pawn pawn, int col, int row)
{
- // FIXME could ask it to the Tile
- float x = cfg.x0 + ((col * cfg.w) + ((cfg.w - pawn.getHeight()) / 2));
- float y = cfg.y0 + ((row * cfg.h) + ((cfg.s - pawn.getWidth()) / 2));
- if ((row % 2) == 1) x += cfg.dw;
+ Vector2 center = getTile(col, row).getCenter();
+ float x = (center.x - (pawn.getWidth() / 2));
+ float y = (center.y - (pawn.getHeight() / 2));
return new Vector2(x, y);
}
diff --git a/core/src/ch/asynk/tankontank/engine/Tile.java b/core/src/ch/asynk/tankontank/engine/Tile.java
index 835f464..8e64ce6 100644
--- a/core/src/ch/asynk/tankontank/engine/Tile.java
+++ b/core/src/ch/asynk/tankontank/engine/Tile.java
@@ -30,6 +30,11 @@ public abstract class Tile implements Drawable
this.overlays.centerOn(x, y);
}
+ public Vector2 getCenter()
+ {
+ return center;
+ }
+
public int push(Pawn pawn)
{
if (stack == null) stack = new ArrayDeque<Pawn>();