summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r--core/src/ch/asynk/tankontank/engine/Board.java1
-rw-r--r--core/src/ch/asynk/tankontank/game/GameStateDirection.java29
-rw-r--r--core/src/ch/asynk/tankontank/game/GameStatePath.java3
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);
}
}