diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2014-09-17 09:22:21 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2014-09-17 09:22:21 +0200 |
commit | 007ee42ea9ce00aa47a18f8e514fdcd018b486a7 (patch) | |
tree | e147983cf66b1074b9bb65252112ace89d96d1ec /core | |
parent | 3b6edd5375770fe6e9080759601896a0bb43d404 (diff) | |
download | RustAndDust-007ee42ea9ce00aa47a18f8e514fdcd018b486a7.zip RustAndDust-007ee42ea9ce00aa47a18f8e514fdcd018b486a7.tar.gz |
split into '.engine.*' and '.game.*'
Diffstat (limited to 'core')
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Map.java (renamed from core/src/ch/asynk/tankontank/game/Map.java) | 18 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/MapImage.java (renamed from core/src/ch/asynk/tankontank/game/MapImage.java) | 2 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Pawn.java (renamed from core/src/ch/asynk/tankontank/game/Pawn.java) | 2 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/PawnImage.java (renamed from core/src/ch/asynk/tankontank/game/PawnImage.java) | 2 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/engine/Tile.java (renamed from core/src/ch/asynk/tankontank/game/Tile.java) | 6 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/GameFactory.java | 4 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Hex.java | 3 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/game/Unit.java | 2 | ||||
-rw-r--r-- | core/src/ch/asynk/tankontank/screens/GameScreen.java | 17 |
9 files changed, 34 insertions, 22 deletions
diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/engine/Map.java index d410502..75aedd9 100644 --- a/core/src/ch/asynk/tankontank/game/Map.java +++ b/core/src/ch/asynk/tankontank/engine/Map.java @@ -1,4 +1,4 @@ -package ch.asynk.tankontank.game; +package ch.asynk.tankontank.engine; import com.badlogic.gdx.math.Vector2; import com.badlogic.gdx.math.Vector3; @@ -31,13 +31,13 @@ public interface Map { public int cols; public int rows; - public int x0 = 83; // map offset - public int y0 = 182; // map offset - public int h = 110; // hex side - public float dh = 53.6f; // hex top should be h/2 - public int w = 189; // hex width - public int dw = 94; // half hex should be w/2 - public float H = h + dh; // total height - public float slope = (dh / (float) dw); + public int x0; // bottom left x offset + public int y0; // bottom left y offset + public int w; // hex width + public int dw; // half hex : w/2 + public int h; // hex side + public float dh; // hex top : h/2 + public float H; // square height : h + dh + public float slope; // north-west side slope : (dh / (float) dw) } } diff --git a/core/src/ch/asynk/tankontank/game/MapImage.java b/core/src/ch/asynk/tankontank/engine/MapImage.java index 2bb330d..07ab9cf 100644 --- a/core/src/ch/asynk/tankontank/game/MapImage.java +++ b/core/src/ch/asynk/tankontank/engine/MapImage.java @@ -1,4 +1,4 @@ -package ch.asynk.tankontank.game; +package ch.asynk.tankontank.engine; import com.badlogic.gdx.Gdx; diff --git a/core/src/ch/asynk/tankontank/game/Pawn.java b/core/src/ch/asynk/tankontank/engine/Pawn.java index 8bbdec4..969e1e9 100644 --- a/core/src/ch/asynk/tankontank/game/Pawn.java +++ b/core/src/ch/asynk/tankontank/engine/Pawn.java @@ -1,4 +1,4 @@ -package ch.asynk.tankontank.game; +package ch.asynk.tankontank.engine; import com.badlogic.gdx.math.Vector3; diff --git a/core/src/ch/asynk/tankontank/game/PawnImage.java b/core/src/ch/asynk/tankontank/engine/PawnImage.java index d8b6d56..77ef752 100644 --- a/core/src/ch/asynk/tankontank/game/PawnImage.java +++ b/core/src/ch/asynk/tankontank/engine/PawnImage.java @@ -1,4 +1,4 @@ -package ch.asynk.tankontank.game; +package ch.asynk.tankontank.engine; import java.util.ArrayDeque; diff --git a/core/src/ch/asynk/tankontank/game/Tile.java b/core/src/ch/asynk/tankontank/engine/Tile.java index a52e728..eaaaf24 100644 --- a/core/src/ch/asynk/tankontank/game/Tile.java +++ b/core/src/ch/asynk/tankontank/engine/Tile.java @@ -1,4 +1,6 @@ -package ch.asynk.tankontank.game; +package ch.asynk.tankontank.engine; + +import java.util.List; public interface Tile { @@ -8,6 +10,8 @@ public interface Tile public Pawn getTop(); + public int costFrom(Side side); + public enum Orientation { KEEP(0), diff --git a/core/src/ch/asynk/tankontank/game/GameFactory.java b/core/src/ch/asynk/tankontank/game/GameFactory.java index 961a39a..3b77f1a 100644 --- a/core/src/ch/asynk/tankontank/game/GameFactory.java +++ b/core/src/ch/asynk/tankontank/game/GameFactory.java @@ -5,6 +5,10 @@ import com.badlogic.gdx.graphics.Texture; import com.badlogic.gdx.graphics.g2d.TextureAtlas; import com.badlogic.gdx.graphics.g2d.TextureRegion; +import ch.asynk.tankontank.engine.Map; +import ch.asynk.tankontank.engine.MapImage; +import ch.asynk.tankontank.engine.Tile; + public class GameFactory { private static TextureAtlas usAtlas; diff --git a/core/src/ch/asynk/tankontank/game/Hex.java b/core/src/ch/asynk/tankontank/game/Hex.java index e3889f9..1222363 100644 --- a/core/src/ch/asynk/tankontank/game/Hex.java +++ b/core/src/ch/asynk/tankontank/game/Hex.java @@ -2,6 +2,9 @@ package ch.asynk.tankontank.game; import java.util.ArrayDeque; +import ch.asynk.tankontank.engine.Tile; +import ch.asynk.tankontank.engine.Pawn; + public class Hex implements Tile { public enum Terrain diff --git a/core/src/ch/asynk/tankontank/game/Unit.java b/core/src/ch/asynk/tankontank/game/Unit.java index 965ed47..61833eb 100644 --- a/core/src/ch/asynk/tankontank/game/Unit.java +++ b/core/src/ch/asynk/tankontank/game/Unit.java @@ -2,6 +2,8 @@ package ch.asynk.tankontank.game; import com.badlogic.gdx.graphics.g2d.TextureRegion; +import ch.asynk.tankontank.engine.PawnImage; + public class Unit extends PawnImage { public int rng; diff --git a/core/src/ch/asynk/tankontank/screens/GameScreen.java b/core/src/ch/asynk/tankontank/screens/GameScreen.java index 1dde462..765fae2 100644 --- a/core/src/ch/asynk/tankontank/screens/GameScreen.java +++ b/core/src/ch/asynk/tankontank/screens/GameScreen.java @@ -30,13 +30,12 @@ import ch.asynk.tankontank.TankOnTank; import ch.asynk.tankontank.game.GameFactory; import ch.asynk.tankontank.game.GameFactory.UnitType; -// interfaces -import ch.asynk.tankontank.game.Map; -import ch.asynk.tankontank.game.Tile; -import ch.asynk.tankontank.game.Pawn; +import ch.asynk.tankontank.engine.Map; +import ch.asynk.tankontank.engine.Tile; +import ch.asynk.tankontank.engine.Pawn; -import ch.asynk.tankontank.game.MapImage; // addActor -import ch.asynk.tankontank.game.Unit; // addActor +import ch.asynk.tankontank.engine.PawnImage; // addActor +import ch.asynk.tankontank.engine.MapImage; // addActor public class GameScreen implements Screen { @@ -113,9 +112,9 @@ public class GameScreen implements Screen private void addUnit(Stage stage, UnitType t, int col, int row, Tile.Orientation o) { - Unit u = GameFactory.getUnit(t); - map.setPawnAt((Pawn) u, col, row, o); - stage.addActor(u); + PawnImage p = GameFactory.getUnit(t); + map.setPawnAt(p, col, row, o); + stage.addActor(p); } private InputMultiplexer getMultiplexer() |