From ca2e19375c9a28f3c15262c413166d11c3a9e3bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my=20Zurcher?= Date: Fri, 3 Oct 2014 11:51:34 +0200 Subject: remove debug output --- core/src/ch/asynk/tankontank/engine/Board.java | 1 - .../asynk/tankontank/game/GameStateDirection.java | 29 +++++++++++++++++++++- .../ch/asynk/tankontank/game/GameStatePath.java | 3 ++- 3 files changed, 30 insertions(+), 3 deletions(-) diff --git a/core/src/ch/asynk/tankontank/engine/Board.java b/core/src/ch/asynk/tankontank/engine/Board.java index cdc8504..d6ee64d 100644 --- a/core/src/ch/asynk/tankontank/engine/Board.java +++ b/core/src/ch/asynk/tankontank/engine/Board.java @@ -345,7 +345,6 @@ public abstract class Board implements Disposable for (int i = (nodes.size() - 1); i >= 0; i--) { SearchBoard.Node node = nodes.get(i); - System.out.println(node.col+" "+node.row); if (prevVector == null) { Vector3 p = pawn.getLastPosition(); diff --git a/core/src/ch/asynk/tankontank/game/GameStateDirection.java b/core/src/ch/asynk/tankontank/game/GameStateDirection.java index 5b98e39..a65c742 100644 --- a/core/src/ch/asynk/tankontank/game/GameStateDirection.java +++ b/core/src/ch/asynk/tankontank/game/GameStateDirection.java @@ -1,6 +1,8 @@ package ch.asynk.tankontank.game; -public class GameStateDirection implements GameState +import ch.asynk.tankontank.engine.Orientation; + +public class GameStateDirection extends GameStateCommon { @Override public void touchDown() @@ -10,5 +12,30 @@ public class GameStateDirection implements GameState @Override public void touchUp() { + Orientation o = Orientation.KEEP;; + if (downHex.y == hex.y) { + if (downHex.x == (hex.x - 1)) { + o = Orientation.SOUTH; + } else if (downHex.x == (hex.x + 1)) { + o = Orientation.NORTH; + } + } else if (downHex.y == (hex.y - 1)) { + if (downHex.x == (hex.x - 1)) { + o = Orientation.SOUTH_EAST; + } else if (downHex.x == hex.x) { + o = Orientation.NORTH_EAST; + } + + } else if (downHex.y == (hex.y + 1)) { + if (downHex.x == hex.x) { + o = Orientation.SOUTH_WEST; + } else if (downHex.x == (hex.x + 1)) { + o = Orientation.NORTH_WEST; + } + } + + if (o != Orientation.KEEP) { + map.movePawn(pawn, o); + } } } diff --git a/core/src/ch/asynk/tankontank/game/GameStatePath.java b/core/src/ch/asynk/tankontank/game/GameStatePath.java index c13c14a..5bd3964 100644 --- a/core/src/ch/asynk/tankontank/game/GameStatePath.java +++ b/core/src/ch/asynk/tankontank/game/GameStatePath.java @@ -22,8 +22,9 @@ public class GameStatePath extends GameStateCommon } if (s == 1) { + hex.set(to.x, to.y); map.enableFinalPath(to, true); - ctrl.setState(State.DIRECTION, true); + ctrl.setState(State.DIRECTION, false); } } -- cgit v1.1-2-g2b99