From 19d5e4831625f717871b02dac6ace32cd90a885d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Sat, 29 Nov 2014 23:26:56 +0100 Subject: StateSelect: clear selected unit if touch out of possibilities --- core/src/ch/asynk/tankontank/game/states/StateSelect.java | 6 ++++-- core/src/ch/asynk/tankontank/screens/GameScreen.java | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/core/src/ch/asynk/tankontank/game/states/StateSelect.java b/core/src/ch/asynk/tankontank/game/states/StateSelect.java index 14d0d1b..ed64a0e 100644 --- a/core/src/ch/asynk/tankontank/game/states/StateSelect.java +++ b/core/src/ch/asynk/tankontank/game/states/StateSelect.java @@ -58,7 +58,6 @@ public class StateSelect extends StateCommon @Override public void touchUp() { - if (!isEnemy) { if (map.possibleMoves.contains(upHex)) { // quick move @@ -75,8 +74,10 @@ public class StateSelect extends StateCommon } hidePossibilities(); - if (upHex.isOffMap()) + if (upHex.isOffMap()) { + selectedUnit = null; return; + } Unit unit = upHex.getUnit(); @@ -84,6 +85,7 @@ public class StateSelect extends StateCommon isEnemy = false; ctrl.hud.actionButtons.hide(); map.clearAll(); + selectedUnit = null; return; } diff --git a/core/src/ch/asynk/tankontank/screens/GameScreen.java b/core/src/ch/asynk/tankontank/screens/GameScreen.java index 13bb805..497dc5b 100644 --- a/core/src/ch/asynk/tankontank/screens/GameScreen.java +++ b/core/src/ch/asynk/tankontank/screens/GameScreen.java @@ -231,6 +231,7 @@ public class GameScreen implements Screen { // TankOnTank.debug("GameScreen", "resize (" + width + "," + height + ")"); mapViewport.update(width, height); + // FIXME hudViewort must always match with map // hudViewport.update(width, height); maxZoomOut = Math.min((virtualWidth / cam.viewportWidth), (virtualHeight / cam.viewportHeight)); -- cgit v1.1-2-g2b99