diff options
Diffstat (limited to 'core/src/ch')
-rw-r--r-- | core/src/ch/asynk/tankontank/game/states/GameStateMove.java | 4 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/states/GameStateSelect.java | 14 |
2 files changed, 17 insertions, 1 deletions
diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateMove.java b/core/src/ch/asynk/tankontank/game/states/GameStateMove.java index 0c12ef1..8c76484 100644 --- a/core/src/ch/asynk/tankontank/game/states/GameStateMove.java +++ b/core/src/ch/asynk/tankontank/game/states/GameStateMove.java @@ -13,6 +13,10 @@ public class GameStateMove extends GameStateCommon from.set(hex); activePawn = pawn; map.buildAndShowMovesAndAssits(activePawn, from); + if (to.x != -1) { + upHex.set(to); + touchUp(); + } } else { if ((activePawn == pawn) || !pawn.canMove()) { upHex.set(map.getFirstMoveAssist()); diff --git a/core/src/ch/asynk/tankontank/game/states/GameStateSelect.java b/core/src/ch/asynk/tankontank/game/states/GameStateSelect.java index b4c10f0..b4df8c0 100644 --- a/core/src/ch/asynk/tankontank/game/states/GameStateSelect.java +++ b/core/src/ch/asynk/tankontank/game/states/GameStateSelect.java @@ -5,6 +5,8 @@ import ch.asynk.tankontank.game.GameCtrl; public class GameStateSelect extends GameStateCommon { + private boolean jumpToMove; + public GameStateSelect(GameCtrl ctrl, Map map) { super(ctrl, map); @@ -14,6 +16,7 @@ public class GameStateSelect extends GameStateCommon public void enter(boolean flag) { ctrl.hud.hide(); + jumpToMove = false; } @Override @@ -25,12 +28,21 @@ public class GameStateSelect extends GameStateCommon @Override public void touchDown() { - reselectHex(); + if (map.isInPossibleMoves(downHex)) + jumpToMove = true; + else + reselectHex(); } @Override public void touchUp() { + if (jumpToMove) { + to.set(downHex); + ctrl.setState(State.MOVE); + return; + } + hidePossibleTargetsMovesAssists(); if (hasPawn()) { int moves = map.buildPossibleMoves(pawn, hex); |