summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-09-16 21:52:34 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-09-16 21:52:34 +0200
commit72b62231b61a6887a74230655ea194afba9d0704 (patch)
tree8ba00f2a5ca8af0cd148c4d916456d5e7aabd210 /core/src/ch/asynk/tankontank
parent157656391964c41465bb0380a096cea5d8d72172 (diff)
downloadRustAndDust-72b62231b61a6887a74230655ea194afba9d0704.zip
RustAndDust-72b62231b61a6887a74230655ea194afba9d0704.tar.gz
add Pawn#setPawnAt
Diffstat (limited to 'core/src/ch/asynk/tankontank')
-rw-r--r--core/src/ch/asynk/tankontank/game/HexMap.java2
-rw-r--r--core/src/ch/asynk/tankontank/game/HexMapImage.java7
-rw-r--r--core/src/ch/asynk/tankontank/screens/GameScreen.java2
3 files changed, 10 insertions, 1 deletions
diff --git a/core/src/ch/asynk/tankontank/game/HexMap.java b/core/src/ch/asynk/tankontank/game/HexMap.java
index faf9881..51c0ebb 100644
--- a/core/src/ch/asynk/tankontank/game/HexMap.java
+++ b/core/src/ch/asynk/tankontank/game/HexMap.java
@@ -23,6 +23,8 @@ public interface HexMap
public void movePawnTo(Pawn pawn, Vector3 coords);
+ public void setPawnAt(Pawn pawn, int col, int row, HexOrientation o);
+
public void movePawnTo(Pawn pawn, int col, int row, HexOrientation o);
}
diff --git a/core/src/ch/asynk/tankontank/game/HexMapImage.java b/core/src/ch/asynk/tankontank/game/HexMapImage.java
index c78fd55..0916808 100644
--- a/core/src/ch/asynk/tankontank/game/HexMapImage.java
+++ b/core/src/ch/asynk/tankontank/game/HexMapImage.java
@@ -98,6 +98,13 @@ public class HexMapImage extends Image implements HexMap
movePawnTo(pawn, p.x, p.y, HexOrientation.KEEP);
}
+ public void setPawnAt(final Pawn pawn, final int col, final int row, HexOrientation o)
+ {
+ int z = pushPawnAt(pawn, col, row);
+ Vector2 pos = getPawnPosAt(pawn, col, row);
+ pawn.pushMove(pos.x, pos.y, z, o);
+ }
+
public void movePawnTo(final Pawn pawn, final int col, final int row, HexOrientation o)
{
GridPoint2 prev = getHexAt(pawn.getLastPosition());
diff --git a/core/src/ch/asynk/tankontank/screens/GameScreen.java b/core/src/ch/asynk/tankontank/screens/GameScreen.java
index 0c4ebff..d7e2e4a 100644
--- a/core/src/ch/asynk/tankontank/screens/GameScreen.java
+++ b/core/src/ch/asynk/tankontank/screens/GameScreen.java
@@ -107,7 +107,7 @@ public class GameScreen extends AbstractScreen
private void addUnit(Stage stage, UnitType t, int col, int row, HexOrientation o)
{
Unit u = UnitFactory.getUnit(t);
- map.movePawnTo((Pawn) u, col, row, o);
+ map.setPawnAt((Pawn) u, col, row, o);
stage.addActor(u);
}