diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-09-24 12:31:17 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-09-24 12:31:17 +0200 |
commit | 45c07ef8f9506320858140bb329c34d9edd10ec7 (patch) | |
tree | b2f7bcb61c5fc7957e79fcefc56c7a3b28fc6214 /core/src | |
parent | bc2944721af54bb05ccb3f402210818aac4632ca (diff) | |
download | RustAndDust-45c07ef8f9506320858140bb329c34d9edd10ec7.zip RustAndDust-45c07ef8f9506320858140bb329c34d9edd10ec7.tar.gz |
RIGHT click to show reachable
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Map.java | 12 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/screens/GameScreen.java | 4 |
2 files changed, 15 insertions, 1 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java index 3418d56..b7ee78e 100644 --- a/core/src/ch/asynk/tankontank/game/Map.java +++ b/core/src/ch/asynk/tankontank/game/Map.java @@ -57,6 +57,18 @@ public abstract class Map extends Board } } + public void showMoves(float x, float y) + { + for(GridPoint2 hex : areaPoints) + enableOverlayOn(hex.x, hex.y, Hex.GREEN, false); + + getHexAt(currentHex, x, y); + Pawn pawn = getTopPawnAt(currentHex); + if (pawn == null) return; + for(GridPoint2 hex : reachableFrom(pawn, currentHex.x, currentHex.y)) + enableOverlayOn(hex.x, hex.y, Hex.GREEN, true); + } + private void debugMap() { int o = Hex.FOG; diff --git a/core/src/ch/asynk/tankontank/screens/GameScreen.java b/core/src/ch/asynk/tankontank/screens/GameScreen.java index 7e53900..5b60bcc 100644 --- a/core/src/ch/asynk/tankontank/screens/GameScreen.java +++ b/core/src/ch/asynk/tankontank/screens/GameScreen.java @@ -151,7 +151,9 @@ public class GameScreen implements Screen dragPos.set(x, y); cam.unproject(touchPos.set(x, y, 0)); map.touchDown(touchPos.x, touchPos.y); - // map.setPosition(map.getX()-20, map.getY()-20); + } else if (button == Input.Buttons.RIGHT) { + cam.unproject(touchPos.set(x, y, 0)); + map.showMoves(touchPos.x, touchPos.y); } return true; } |