diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-09-17 09:28:53 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-09-17 09:28:53 +0200 |
commit | 1259e9aee8da8367807b32632ba5311947206944 (patch) | |
tree | 14b4b60738994e36389067bd9979b6c40297f66e | |
parent | 007ee42ea9ce00aa47a18f8e514fdcd018b486a7 (diff) | |
download | RustAndDust-1259e9aee8da8367807b32632ba5311947206944.zip RustAndDust-1259e9aee8da8367807b32632ba5311947206944.tar.gz |
Map.Config: rename some fields for clarity
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Map.java | 6 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/MapImage.java | 12 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/GameFactory.java | 6 |
3 files changed, 12 insertions, 12 deletions
diff --git a/core/src/ch/asynk/tankontank/engine/Map.java b/core/src/ch/asynk/tankontank/engine/Map.java index 75aedd9..e221fe8 100644 --- a/core/src/ch/asynk/tankontank/engine/Map.java +++ b/core/src/ch/asynk/tankontank/engine/Map.java @@ -35,9 +35,9 @@ public interface Map public int y0; // bottom left y offset public int w; // hex width public int dw; // half hex : w/2 - public int h; // hex side - public float dh; // hex top : h/2 - public float H; // square height : h + dh + public int s; // hex side + public float dh; // hex top : s/2 + public float h; // square height : s + dh public float slope; // north-west side slope : (dh / (float) dw) } } diff --git a/core/src/ch/asynk/tankontank/engine/MapImage.java b/core/src/ch/asynk/tankontank/engine/MapImage.java index 07ab9cf..b016852 100644 --- a/core/src/ch/asynk/tankontank/engine/MapImage.java +++ b/core/src/ch/asynk/tankontank/engine/MapImage.java @@ -52,7 +52,7 @@ public class MapImage extends Image implements Map public Vector2 getHexCenterAt(GridPoint2 cell) { float x = cfg.x0 + ((cell.x * cfg.w) + (cfg.w / 2)); - float y = cfg.y0 + ((cell.y * cfg.H) + (cfg.h / 2)); + float y = cfg.y0 + ((cell.y * cfg.h) + (cfg.s / 2)); if ((cell.y % 2) == 1) x += cfg.dw; return new Vector2(x, y); } @@ -65,7 +65,7 @@ public class MapImage extends Image implements Map private Vector2 getPawnPosAt(Pawn pawn, int col, int row) { float x = cfg.x0 + ((col * cfg.w) + ((cfg.w - pawn.getHeight()) / 2)); - float y = cfg.y0 + ((row * cfg.H) + ((cfg.h - pawn.getWidth()) / 2)); + float y = cfg.y0 + ((row * cfg.h) + ((cfg.s - pawn.getWidth()) / 2)); if ((row % 2) == 1) x += cfg.dw; return new Vector2(x, y); } @@ -122,7 +122,7 @@ public class MapImage extends Image implements Map if (y < 0.f) { row = -1; } else { - row = (int) (y / cfg.H); + row = (int) (y / cfg.h); oddRow = ((row % 2) == 1); } @@ -137,9 +137,9 @@ public class MapImage extends Image implements Map } // check upper boundaries - float dy = (y - (row * cfg.H)); - if (dy > cfg.h) { - dy -= cfg.h; + float dy = (y - (row * cfg.h)); + if (dy > cfg.s) { + dy -= cfg.s; float dx = (x - (col * cfg.w)); if (dx < cfg.dw) { if ((dx * cfg.slope) < dy) { diff --git a/core/src/ch/asynk/tankontank/game/GameFactory.java b/core/src/ch/asynk/tankontank/game/GameFactory.java index 3b77f1a..f5c113c 100644 --- a/core/src/ch/asynk/tankontank/game/GameFactory.java +++ b/core/src/ch/asynk/tankontank/game/GameFactory.java @@ -113,11 +113,11 @@ public class GameFactory cfg.rows = 9; cfg.x0 = 83; cfg.y0 = 182; - cfg.h = 110; - cfg.dh = 53.6f; cfg.w = 189; cfg.dw = 94; - cfg.H = cfg.h + cfg.dh; + cfg.s = 110; + cfg.dh = 53.6f; + cfg.h = cfg.s + cfg.dh; cfg.slope = (cfg.dh / (float) cfg.dw); return cfg; |