summaryrefslogtreecommitdiffstats
path: root/core/src/ch/asynk
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
parent89d7b4152f06168c896e5e22f012e60a8c227bba (diff)
downloadRustAndDust-0fdbab66ee2fb45e018ea4efd090e01bac01fddb.zip
RustAndDust-0fdbab66ee2fb45e018ea4efd090e01bac01fddb.tar.gz
fix according to new assets
Diffstat (limited to 'core/src/ch/asynk')
-rw-r--r--core/src/ch/asynk/tankontank/TankOnTank.java20
-rw-r--r--core/src/ch/asynk/tankontank/engine/HeadedPawn.java6
-rw-r--r--core/src/ch/asynk/tankontank/engine/Pawn.java6
-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
7 files changed, 44 insertions, 63 deletions
diff --git a/core/src/ch/asynk/tankontank/TankOnTank.java b/core/src/ch/asynk/tankontank/TankOnTank.java
index 2590c30..a9933bb 100644
--- a/core/src/ch/asynk/tankontank/TankOnTank.java
+++ b/core/src/ch/asynk/tankontank/TankOnTank.java
@@ -30,26 +30,18 @@ public class TankOnTank extends Game
public void loadAssets()
{
Gdx.app.debug("TankOnTank", " load assets : " + (Gdx.app.getJavaHeap()/1024.0f) + "KB");
- manager.load("images/map_a.png", Texture.class);
- manager.load("images/map_b.png", Texture.class);
- manager.load("images/counters.atlas", TextureAtlas.class);
- manager.load("images/ge.atlas", TextureAtlas.class);
- manager.load("images/us.atlas", TextureAtlas.class);
- manager.load("images/hex.atlas", TextureAtlas.class);
- manager.load("images/unit.atlas", TextureAtlas.class);
+ manager.load("data/map_a.png", Texture.class);
+ manager.load("data/map_b.png", Texture.class);
+ manager.load("data/pawns.atlas", TextureAtlas.class);
}
public void unloadAssets()
{
Gdx.app.debug("TankOnTank", "unload assets : " + (Gdx.app.getJavaHeap()/1024.0f) + "KB");
Gdx.app.debug("TankOnTank", "diagnostics:\n" + manager.getDiagnostics() );
- manager.unload("images/map_a.png");
- manager.unload("images/map_b.png");
- manager.unload("images/counters.atlas");
- manager.unload("images/ge.atlas");
- manager.unload("images/us.atlas");
- manager.unload("images/hex.atlas");
- manager.unload("images/unit.atlas");
+ manager.unload("data/map_a.png");
+ manager.unload("data/map_b.png");
+ manager.unload("data/pawns.atlas");
Gdx.app.debug("TankOnTank", "diagnostics:\n" + manager.getDiagnostics() );
}
diff --git a/core/src/ch/asynk/tankontank/engine/HeadedPawn.java b/core/src/ch/asynk/tankontank/engine/HeadedPawn.java
index b52c56c..4f3a350 100644
--- a/core/src/ch/asynk/tankontank/engine/HeadedPawn.java
+++ b/core/src/ch/asynk/tankontank/engine/HeadedPawn.java
@@ -14,10 +14,10 @@ public abstract class HeadedPawn extends Pawn
private Image head;
protected Orientation orientation;
- public HeadedPawn(TextureRegion pawn, TextureRegion head, TextureAtlas overlays)
+ public HeadedPawn(TextureAtlas atlas, String pawn, String head)
{
- super(pawn, overlays);
- this.head = new Image(head);
+ super(atlas, pawn);
+ this.head = new Image(atlas.findRegion(head));
this.orientation = Orientation.KEEP;
}
diff --git a/core/src/ch/asynk/tankontank/engine/Pawn.java b/core/src/ch/asynk/tankontank/engine/Pawn.java
index 22da2ed..989c57f 100644
--- a/core/src/ch/asynk/tankontank/engine/Pawn.java
+++ b/core/src/ch/asynk/tankontank/engine/Pawn.java
@@ -39,10 +39,10 @@ public abstract class Pawn implements Drawable, Disposable
{
}
- public Pawn(TextureRegion pawn, TextureAtlas overlays)
+ public Pawn(TextureAtlas atlas, String pawn)
{
- image = new Image(pawn);
- this.overlays = new StackedImages(overlays);
+ image = new Image(atlas.findRegion(pawn));
+ this.overlays = new StackedImages(atlas);
}
public Vector3 getLastPosition()
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;