summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/ch/asynk/tankontank')
-rw-r--r--core/src/ch/asynk/tankontank/game/Map.java13
1 files changed, 12 insertions, 1 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java
index 2c2e775..d8458f1 100644
--- a/core/src/ch/asynk/tankontank/game/Map.java
+++ b/core/src/ch/asynk/tankontank/game/Map.java
@@ -6,14 +6,17 @@ import java.util.HashSet;
import com.badlogic.gdx.graphics.Texture;
import com.badlogic.gdx.graphics.g2d.TextureAtlas;
import com.badlogic.gdx.math.Vector2;
+import com.badlogic.gdx.math.Vector3;
import com.badlogic.gdx.math.GridPoint2;
import com.badlogic.gdx.graphics.glutils.ShapeRenderer;
-import ch.asynk.tankontank.engine.Board;
import ch.asynk.tankontank.engine.Pawn;
+import ch.asynk.tankontank.engine.Board;
+import ch.asynk.tankontank.engine.Orientation;
public abstract class Map extends Board
{
+ private final Vector<Vector3> finalPath = new Vector<Vector3>(10);
private final Vector<GridPoint2> possibleMoves = new Vector<GridPoint2>(20);
private final Vector<GridPoint2> possibleTargets = new Vector<GridPoint2>(10);
private final HashSet<GridPoint2> possiblePaths = new HashSet<GridPoint2>(10);
@@ -99,6 +102,14 @@ public abstract class Map extends Board
return possiblePathsFilterToggle(hex, possiblePaths);
}
+ public void movePawn(Pawn pawn, Orientation o)
+ {
+ int s = getFinalPath(pawn, finalPath, o);
+ if (s > 0) {
+ movePawn(pawn, finalPath);
+ }
+ }
+
public void clearPossibles()
{
enablePossibleMoves(false);