diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2015-11-20 18:50:45 +0100 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2015-11-20 18:50:45 +0100 |
commit | ba674a419285aa6bf2824f5824957350327a5c27 (patch) | |
tree | f7e8d62ef863ec59628ed01fc7beeb6a529ebf20 /core/src | |
parent | b706be0519cfa130acf4e4f4ae9f9827762c8109 (diff) | |
download | RustAndDust-ba674a419285aa6bf2824f5824957350327a5c27.zip RustAndDust-ba674a419285aa6bf2824f5824957350327a5c27.tar.gz |
add Map00 ...
Diffstat (limited to 'core/src')
-rw-r--r-- | core/src/ch/asynk/rustanddust/RustAndDust.java | 4 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/battles/Factory.java | 4 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/game/battles/Map00.java | 89 |
3 files changed, 97 insertions, 0 deletions
diff --git a/core/src/ch/asynk/rustanddust/RustAndDust.java b/core/src/ch/asynk/rustanddust/RustAndDust.java index adc83e8..29a5c69 100644 --- a/core/src/ch/asynk/rustanddust/RustAndDust.java +++ b/core/src/ch/asynk/rustanddust/RustAndDust.java @@ -93,6 +93,8 @@ public class RustAndDust extends Game manager.load("data/map_a.png", Texture.class); if (config.battle.getMapType() == Factory.MapType.MAP_B) manager.load("data/map_b.png", Texture.class); + if (config.battle.getMapType() == Factory.MapType.MAP_00) + manager.load("data/map_00.png", Texture.class); int i = config.graphics.i; manager.load(String.format("data/units%d.atlas",i), TextureAtlas.class); manager.load(String.format("data/unit-overlays%d.atlas", i), TextureAtlas.class); @@ -122,6 +124,8 @@ public class RustAndDust extends Game manager.unload("data/map_a.png"); if (config.battle.getMapType() == Factory.MapType.MAP_B) manager.unload("data/map_b.png"); + if (config.battle.getMapType() == Factory.MapType.MAP_00) + manager.unload("data/map_00.png"); int i = config.graphics.i; manager.unload(String.format("data/units%d.atlas",i)); manager.unload(String.format("data/unit-overlays%d.atlas", i)); diff --git a/core/src/ch/asynk/rustanddust/game/battles/Factory.java b/core/src/ch/asynk/rustanddust/game/battles/Factory.java index 926d82a..0f232c4 100644 --- a/core/src/ch/asynk/rustanddust/game/battles/Factory.java +++ b/core/src/ch/asynk/rustanddust/game/battles/Factory.java @@ -25,6 +25,7 @@ public class Factory implements Board.TileBuilder, Disposable { public enum MapType { + MAP_00, MAP_A, MAP_B } @@ -83,6 +84,9 @@ public class Factory implements Board.TileBuilder, Disposable { Map m = null; switch(t) { + case MAP_00: + m = new Map00(game, "data/map_00.png", "data/hex.png"); + break; case MAP_A: m = new MapA(game, "data/map_a.png", "data/hex.png"); break; diff --git a/core/src/ch/asynk/rustanddust/game/battles/Map00.java b/core/src/ch/asynk/rustanddust/game/battles/Map00.java new file mode 100644 index 0000000..618fe45 --- /dev/null +++ b/core/src/ch/asynk/rustanddust/game/battles/Map00.java @@ -0,0 +1,89 @@ +package ch.asynk.rustanddust.game.battles; + +import ch.asynk.rustanddust.RustAndDust; +import ch.asynk.rustanddust.engine.Board; +import ch.asynk.rustanddust.engine.Orientation; +import ch.asynk.rustanddust.game.Map; +import ch.asynk.rustanddust.game.Hex; + +public class Map00 extends Map +{ + public Map00(final RustAndDust game, String map, String hex) + { + super(game, map, hex); + } + + @Override + protected Board.Config getConfig() + { + Board.Config cfg = new Board.Config(); + cfg.cols = 10; + cfg.rows = 9; + cfg.s = 110; + cfg.x0 = 50; + cfg.y0 = 103; + cfg.w = cfg.s * 1.73205f; + cfg.dw = cfg.w / 2.0f; + cfg.dh = cfg.s / 2.0f; + cfg.h = cfg.s + cfg.dh; + cfg.slope = (cfg.dh / (float) cfg.dw); + + return cfg; + } + + @Override + protected void setup() + { + getHex(6, 1).terrain = Hex.Terrain.HILLS; + getHex(5, 7).terrain = Hex.Terrain.HILLS; + getHex(6, 8).terrain = Hex.Terrain.HILLS; + getHex(7, 8).terrain = Hex.Terrain.HILLS; + getHex(9, 4).terrain = Hex.Terrain.HILLS; + getHex(10, 4).terrain = Hex.Terrain.HILLS; + + getHex(2, 2).terrain = Hex.Terrain.WOODS; + getHex(3, 3).terrain = Hex.Terrain.WOODS; + getHex(6, 5).terrain = Hex.Terrain.WOODS; + getHex(7, 5).terrain = Hex.Terrain.WOODS; + getHex(8, 6).terrain = Hex.Terrain.WOODS; + getHex(9, 6).terrain = Hex.Terrain.WOODS; + getHex(8, 1).terrain = Hex.Terrain.WOODS; + getHex(8, 2).terrain = Hex.Terrain.WOODS; + + getHex(5, 2).terrain = Hex.Terrain.TOWN; + getHex(11, 7).terrain = Hex.Terrain.TOWN; + + getHex(10, 1).terrain = Hex.Terrain.OFFMAP; + getHex(11, 3).terrain = Hex.Terrain.OFFMAP; + getHex(12, 5).terrain = Hex.Terrain.OFFMAP; + getHex(13, 7).terrain = Hex.Terrain.OFFMAP; + + int N = Orientation.NORTH.s; + int S = Orientation.SOUTH.s; + int NE = Orientation.NORTH_EAST.s; + int NW = Orientation.NORTH_WEST.s; + int SE = Orientation.SOUTH_EAST.s; + int SW = Orientation.SOUTH_WEST.s; + + getHex(3, 5).roads = (S | N); + getHex(4, 5).roads = (S | N); + getHex(5, 5).roads = (S | NE); + getHex(5, 4).roads = (SW | N); + getHex(6, 4).roads = (S | SE | N); + getHex(7, 4).roads = (S | N); + getHex(8, 4).roads = (S | NW | NE); + getHex(8, 3).roads = (SW | N); + getHex(9, 3).roads = (S | N); + getHex(10, 3).roads = (S | N); + + getHex(9, 5).roads = (SE | NW); + getHex(10, 6).roads = (SE | NW); + getHex(11, 7).roads = (SE | SW); + getHex(11, 8).roads = (NE | SW); + + getHex(5, 3).roads = (NE | NW); + getHex(5, 2).roads = (SE | SW); + getHex(4, 1).roads = (NE | NW); + getHex(4, 0).roads = (SW | NE | NW); + } +} |