summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk/tankontank/game
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2014-10-04 01:39:31 +0200
committerJérémy Zurcher <jeremy@asynk.ch>2014-10-04 01:39:31 +0200
commit0fdbab66ee2fb45e018ea4efd090e01bac01fddb (patch)
treecf40d1083741f953bb91713f9ade529e1810b9a9 /core/src/ch/asynk/tankontank/game
parent89d7b4152f06168c896e5e22f012e60a8c227bba (diff)
downloadRustAndDust-0fdbab66ee2fb45e018ea4efd090e01bac01fddb.zip
RustAndDust-0fdbab66ee2fb45e018ea4efd090e01bac01fddb.tar.gz
fix according to new assets
Diffstat (limited to 'core/src/ch/asynk/tankontank/game')
-rw-r--r--core/src/ch/asynk/tankontank/game/GameFactory.java51
-rw-r--r--core/src/ch/asynk/tankontank/game/Hex.java5
-rw-r--r--core/src/ch/asynk/tankontank/game/Map.java11
-rw-r--r--core/src/ch/asynk/tankontank/game/Unit.java8
4 files changed, 32 insertions, 43 deletions
diff --git a/core/src/ch/asynk/tankontank/game/GameFactory.java b/core/src/ch/asynk/tankontank/game/GameFactory.java
index cb0ad2f..d18dc8f 100644
--- a/core/src/ch/asynk/tankontank/game/GameFactory.java
+++ b/core/src/ch/asynk/tankontank/game/GameFactory.java
@@ -10,26 +10,17 @@ import ch.asynk.tankontank.engine.Board;
public class GameFactory implements Board.TileBuilder, Disposable
{
- private TextureAtlas usAtlas;
- private TextureAtlas geAtlas;
- private TextureAtlas hexAtlas;
- private TextureAtlas unitAtlas;
+ private TextureAtlas pawnAtlas;
public GameFactory(AssetManager manager)
{
- usAtlas = manager.get("images/us.atlas", TextureAtlas.class);
- geAtlas = manager.get("images/ge.atlas", TextureAtlas.class);
- hexAtlas = manager.get("images/hex.atlas", TextureAtlas.class);
- unitAtlas = manager.get("images/unit.atlas", TextureAtlas.class);
+ pawnAtlas = manager.get("data/pawns.atlas", TextureAtlas.class);
}
@Override
public void dispose()
{
- usAtlas.dispose();
- geAtlas.dispose();
- hexAtlas.dispose();
- unitAtlas.dispose();
+ pawnAtlas.dispose();
}
public enum UnitType
@@ -57,49 +48,49 @@ public class GameFactory implements Board.TileBuilder, Disposable
Unit u = null;
switch(t) {
case GE_AT_GUN:
- u = new Unit(Army.GE, false, 3, 8, 9, 1, geAtlas.findRegion("at-gun"), geAtlas.findRegion("head"), unitAtlas);
+ u = new Unit(Army.GE, false, 3, 8, 9, 1, pawnAtlas, "ge-at-gun", "head");
break;
case GE_INFANTRY:
- u = new Unit(Army.GE, false, 1, 7, 10, 1, geAtlas.findRegion("infantry"), geAtlas.findRegion("head"), unitAtlas);
+ u = new Unit(Army.GE, false, 1, 7, 10, 1, pawnAtlas, "ge-infantry", "head");
break;
case GE_KINGTIGER:
- u = new Unit(Army.GE, false, 3, 12, 1, geAtlas.findRegion("kingtiger"), geAtlas.findRegion("head"), unitAtlas);
+ u = new Unit(Army.GE, false, 3, 12, 1, pawnAtlas, "ge-kingtiger", "head");
break;
case GE_PANZER_IV:
- u = new Unit(Army.GE, false, 2, 9, 2, geAtlas.findRegion("panzer-iv"), geAtlas.findRegion("head"), unitAtlas);
+ u = new Unit(Army.GE, false, 2, 9, 2, pawnAtlas, "ge-panzer-iv", "head");
break;
case GE_PANZER_IV_HQ:
- u = new Unit(Army.GE, true, 2, 9, 2, geAtlas.findRegion("panzer-iv-hq"), geAtlas.findRegion("head"), unitAtlas);
+ u = new Unit(Army.GE, true, 2, 9, 2, pawnAtlas, "ge-panzer-iv-hq", "head");
break;
case GE_TIGER:
- u = new Unit(Army.GE, false, 3, 11, 1, geAtlas.findRegion("tiger"), geAtlas.findRegion("head"), unitAtlas);
+ u = new Unit(Army.GE, false, 3, 11, 1, pawnAtlas, "ge-tiger", "head");
break;
case GE_WESPE:
- u = new Unit(Army.GE, false, 5, 8, 1, geAtlas.findRegion("wespe"), geAtlas.findRegion("head"), unitAtlas);
+ u = new Unit(Army.GE, false, 5, 8, 1, pawnAtlas, "ge-wespe", "head");
break;
case US_AT_GUN:
- u = new Unit(Army.US, false, 1, 7, 10, 1, usAtlas.findRegion("at-gun"), usAtlas.findRegion("head"), unitAtlas);
+ u = new Unit(Army.US, false, 1, 7, 10, 1, pawnAtlas, "us-at-gun", "head");
break;
case US_INFANTRY:
- u = new Unit(Army.US, false, 1, 7, 10, 1, usAtlas.findRegion("infantry"), usAtlas.findRegion("head"), unitAtlas);
+ u = new Unit(Army.US, false, 1, 7, 10, 1, pawnAtlas, "us-infantry", "head");
break;
case US_PERSHING:
- u = new Unit(Army.US, false, 3, 10, 2, usAtlas.findRegion("pershing"), usAtlas.findRegion("head"), unitAtlas);
+ u = new Unit(Army.US, false, 3, 10, 2, pawnAtlas, "us-pershing", "head");
break;
case US_PERSHING_HQ:
- u = new Unit(Army.US, true, 3, 10, 2, usAtlas.findRegion("pershing-hq"), usAtlas.findRegion("head"), unitAtlas);
+ u = new Unit(Army.US, true, 3, 10, 2, pawnAtlas, "us-pershing-hq", "head");
break;
case US_PRIEST:
- u = new Unit(Army.US, false, 5, 8, 1, usAtlas.findRegion("priest"), usAtlas.findRegion("head"), unitAtlas);
+ u = new Unit(Army.US, false, 5, 8, 1, pawnAtlas, "us-priest", "head");
break;
case US_SHERMAN:
- u = new Unit(Army.US, false, 2, 9, 2, usAtlas.findRegion("sherman"), usAtlas.findRegion("sherman-head"), unitAtlas);
+ u = new Unit(Army.US, false, 2, 9, 2, pawnAtlas, "us-sherman", "us-sherman-head");
break;
case US_SHERMAN_HQ:
- u = new Unit(Army.US, true, 2, 9, 2, usAtlas.findRegion("sherman-hq"), usAtlas.findRegion("head"), unitAtlas);
+ u = new Unit(Army.US, true, 2, 9, 2, pawnAtlas, "us-sherman-hq", "head");
break;
case US_WOLVERINE:
- u = new Unit(Army.US, false, 3, 8, 3, usAtlas.findRegion("wolverine"), usAtlas.findRegion("head"), unitAtlas);
+ u = new Unit(Army.US, false, 3, 8, 3, pawnAtlas, "us-wolverine", "head");
break;
}
@@ -136,10 +127,10 @@ public class GameFactory implements Board.TileBuilder, Disposable
Map m = null;
switch(t) {
case MAP_A:
- m = new MapA(this, config(), manager.get("images/map_a.png", Texture.class));
+ m = new MapA(this, config(), manager.get("data/map_a.png", Texture.class));
break;
case MAP_B:
- m = new MapB(this, config(), manager.get("images/map_b.png", Texture.class));
+ m = new MapB(this, config(), manager.get("data/map_b.png", Texture.class));
break;
}
@@ -148,6 +139,6 @@ public class GameFactory implements Board.TileBuilder, Disposable
public Hex getNewTile(float cx, float cy)
{
- return new Hex(cx, cy, hexAtlas);
+ return new Hex(cx, cy, pawnAtlas);
}
}
diff --git a/core/src/ch/asynk/tankontank/game/Hex.java b/core/src/ch/asynk/tankontank/game/Hex.java
index 70377ac..59cc9d3 100644
--- a/core/src/ch/asynk/tankontank/game/Hex.java
+++ b/core/src/ch/asynk/tankontank/game/Hex.java
@@ -25,9 +25,8 @@ public class Hex extends Tile
public static final int BLUE = 1;
public static final int GREEN = 2;
public static final int RED = 3;
- public static final int DOT = 4;
- public static final int MOVE = 5;
- public static final int ROSE = 6;
+ public static final int MOVE = 4;
+ public static final int ROSE = 5;
public Terrain terrain;
public int roads;
diff --git a/core/src/ch/asynk/tankontank/game/Map.java b/core/src/ch/asynk/tankontank/game/Map.java
index b58a1eb..eaa83df 100644
--- a/core/src/ch/asynk/tankontank/game/Map.java
+++ b/core/src/ch/asynk/tankontank/game/Map.java
@@ -61,15 +61,15 @@ public abstract class Map extends Board
enableOverlayOn(hex, Hex.RED, enable);
}
- public void enablePossiblePaths(boolean enable, boolean keepDots)
+ public void enablePossiblePaths(boolean enable, boolean keepMoves)
{
- if (keepDots) {
+ if (keepMoves) {
for(GridPoint2 hex : possiblePaths)
enableOverlayOn(hex, Hex.GREEN, enable);
} else {
for(GridPoint2 hex : possiblePaths) {
enableOverlayOn(hex, Hex.GREEN, enable);
- enableOverlayOn(hex, Hex.DOT, false);
+ enableOverlayOn(hex, Hex.MOVE, false);
}
}
}
@@ -126,15 +126,14 @@ public abstract class Map extends Board
public void toggleDotOverlay(GridPoint2 hex)
{
- boolean enable= !isOverlayEnabledOn(hex, Hex.DOT);
- enableOverlayOn(hex, Hex.DOT, enable);
+ boolean enable= !isOverlayEnabledOn(hex, Hex.MOVE);
+ enableOverlayOn(hex, Hex.MOVE, enable);
}
public void enableFinalPath(GridPoint2 dst, boolean enable)
{
for(GridPoint2 hex : possiblePaths) {
enableOverlayOn(hex, Hex.GREEN, false);
- enableOverlayOn(hex, Hex.DOT, false);
enableOverlayOn(hex, Hex.MOVE, enable);
}
enableOverlayOn(dst, Hex.ROSE, enable);
diff --git a/core/src/ch/asynk/tankontank/game/Unit.java b/core/src/ch/asynk/tankontank/game/Unit.java
index 9d880fd..64eb0c0 100644
--- a/core/src/ch/asynk/tankontank/game/Unit.java
+++ b/core/src/ch/asynk/tankontank/game/Unit.java
@@ -57,9 +57,9 @@ public class Unit extends HeadedPawn
}
// hard tager
- public Unit(Army army, boolean hq, int range, int defense, int movementPoints, TextureRegion unit, TextureRegion head, TextureAtlas overlays)
+ public Unit(Army army, boolean hq, int range, int defense, int movementPoints, TextureAtlas atlas, String unit, String head)
{
- super(unit, head, overlays);
+ super(atlas, unit, head);
this.army = army;
this.hq = hq;
this.rng = range;
@@ -69,9 +69,9 @@ public class Unit extends HeadedPawn
}
// soft tager
- public Unit(Army army, boolean hq, int range, int defense, int concealedDefense, int movementPoints, TextureRegion unit, TextureRegion head, TextureAtlas overlays)
+ public Unit(Army army, boolean hq, int range, int defense, int concealedDefense, int movementPoints, TextureAtlas atlas, String unit, String head)
{
- super(unit, head, overlays);
+ super(atlas, unit, head);
this.army = army;
this.hq = hq;
this.rng = range;