summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-11-29 23:26:56 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2014-11-29 23:26:56 +0100
commit19d5e4831625f717871b02dac6ace32cd90a885d (patch)
tree55786c6a41847c9bbc4676120139b8580cf670fe
parent7da2aef0c8a4fb04fd90b321e17cbf5bc0eaf754 (diff)
downloadRustAndDust-19d5e4831625f717871b02dac6ace32cd90a885d.zip
RustAndDust-19d5e4831625f717871b02dac6ace32cd90a885d.tar.gz
StateSelect: clear selected unit if touch out of possibilities
-rw-r--r--core/src/ch/asynk/tankontank/game/states/StateSelect.java6
-rw-r--r--core/src/ch/asynk/tankontank/screens/GameScreen.java1
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));