diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-07 12:00:06 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-10-07 12:00:06 +0200 |
commit | c1cf9a6c797c91b1a88abd20577218e44df43fc9 (patch) | |
tree | 7d57a780c7b56d58dbc3629803432e42dab05ea6 /core/src/ch | |
parent | 1670f5afbf1fa49a5d7e56829149bb58a379cfd4 (diff) | |
download | RustAndDust-c1cf9a6c797c91b1a88abd20577218e44df43fc9.zip RustAndDust-c1cf9a6c797c91b1a88abd20577218e44df43fc9.tar.gz |
GameStates: improve hex selection scheme
Diffstat (limited to 'core/src/ch')
4 files changed, 10 insertions, 2 deletions
diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateCommon.java b/core/src/ch/asynk/tankontank/game/states/GameStateCommon.java index 249288e..5ef6c0b 100644 --- a/core/src/ch/asynk/tankontank/game/states/GameStateCommon.java +++ b/core/src/ch/asynk/tankontank/game/states/GameStateCommon.java @@ -72,6 +72,11 @@ public abstract class GameStateCommon implements GameState protected void selectHex() { + selectHex(hex); + } + + protected void selectHex(GridPoint2 hex) + { map.enableOverlayOn(hex, Hex.BLUE, true); } diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateDirection.java b/core/src/ch/asynk/tankontank/game/states/GameStateDirection.java index 4615075..581a987 100644 --- a/core/src/ch/asynk/tankontank/game/states/GameStateDirection.java +++ b/core/src/ch/asynk/tankontank/game/states/GameStateDirection.java @@ -24,7 +24,7 @@ public class GameStateDirection extends GameStateCommon clear(); unselectHex(); hex.set(tmp.x, tmp.y); - selectHex(); + unselectHex(); ctrl.setState(State.ANIMATION); } } diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateMove.java b/core/src/ch/asynk/tankontank/game/states/GameStateMove.java index 0cb880e..bc6e535 100644 --- a/core/src/ch/asynk/tankontank/game/states/GameStateMove.java +++ b/core/src/ch/asynk/tankontank/game/states/GameStateMove.java @@ -14,6 +14,7 @@ public class GameStateMove extends GameStateCommon map.enablePossibleTargets(false); map.enablePossiblePaths(false, false); if (hasPawn()) { + selectHex(); skipFirst = false; map.clearPossiblePaths(); map.buildAndShowPossibleMoves(pawn, hex); @@ -77,7 +78,7 @@ public class GameStateMove extends GameStateCommon to.set(upHex.x, upHex.y); map.clearPossiblePaths(); int s = map.buildPossiblePaths(pawn, from, to); - map.togglePathOverlay(downHex); + selectHex(downHex); map.enablePossibleMoves(false); map.enablePossiblePaths(true, true); return s; diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateRotate.java b/core/src/ch/asynk/tankontank/game/states/GameStateRotate.java index 4d36e22..d4bf2ae 100644 --- a/core/src/ch/asynk/tankontank/game/states/GameStateRotate.java +++ b/core/src/ch/asynk/tankontank/game/states/GameStateRotate.java @@ -9,6 +9,7 @@ public class GameStateRotate extends GameStateCommon { map.hidePossibles(); if (hasPawn()) { + selectHex(); map.enableDirections(hex, true); } } @@ -35,6 +36,7 @@ public class GameStateRotate extends GameStateCommon Orientation o = Orientation.fromAdj(hex.x, hex.y, downHex.x, downHex.y); if (o != Orientation.KEEP) { + unselectHex(); map.enableDirections(hex, false); if (pawn.getOrientation() != o) { map.rotatePawn(pawn, o); |