summaryrefslogtreecommitdiffstats
path: root/core/src
diff options
context:
space:
mode:
Diffstat (limited to 'core/src')
-rw-r--r--core/src/ch/asynk/tankontank/engine/Board.java13
1 files changed, 13 insertions, 0 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java
index 0ef2a6e..b74dc87 100644
--- a/core/src/ch/asynk/tankontank/engine/Board.java
+++ b/core/src/ch/asynk/tankontank/engine/Board.java
@@ -151,6 +151,19 @@ public abstract class Board implements Disposable
tiles[5] = getTileSafe((hex.x - 1), (hex.y - 1));
}
+ public GridPoint2 setNeighbour(GridPoint2 hex, Orientation o, GridPoint2 n)
+ {
+ if (o == Orientation.NORTH) n.set((hex.x + 1), hex.y);
+ else if (o == Orientation.NORTH_EAST) n.set(hex.x, (hex.y - 1));
+ else if (o == Orientation.SOUTH_EAST) n.set((hex.x - 1), (hex.y - 1));
+ else if (o == Orientation.SOUTH) n.set((hex.x - 1), hex.y);
+ else if (o == Orientation.SOUTH_WEST) n.set(hex.x, (hex.y + 1));
+ else if (o == Orientation.NORTH_WEST) n.set((hex.x + 1), (hex.y + 1));
+ else n.set(hex.x, hex.y);
+
+ return n;
+ }
+
public float getWidth()
{
return image.getWidth();