Dungeon.buildDungeon() now correctly sets Display up
This commit is contained in:
parent
1f02ffc892
commit
3d81dc6c65
@ -31,7 +31,7 @@ public class Dungeon {
|
|||||||
* S: Scale
|
* S: Scale
|
||||||
* X: Gap
|
* X: Gap
|
||||||
* R: Replicator */
|
* R: Replicator */
|
||||||
Map<String, Tile> buildDungeon(File input) throws IOException
|
Map<String, Tile> buildDungeon(File input, Display display) throws IOException
|
||||||
{
|
{
|
||||||
Tile defaultTile = new Field();
|
Tile defaultTile = new Field();
|
||||||
defaultTile.setX(-666);
|
defaultTile.setX(-666);
|
||||||
@ -63,29 +63,35 @@ public class Dungeon {
|
|||||||
{
|
{
|
||||||
case 'W':
|
case 'W':
|
||||||
tile = new Wall();
|
tile = new Wall();
|
||||||
|
display.addVisual(new WallDrawer((Wall) tile));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'F':
|
case 'F':
|
||||||
tile = new Field();
|
tile = new Field();
|
||||||
|
display.addVisual(new FieldDrawer((Field) tile));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'Z':
|
case 'Z':
|
||||||
tile = new Field();
|
tile = new Field();
|
||||||
|
display.addVisual(new FieldDrawer((Field) tile));
|
||||||
tile.setZPMOnTile(new ZPM());
|
tile.setZPMOnTile(new ZPM());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'B':
|
case 'B':
|
||||||
tile = new Field();
|
tile = new Field();
|
||||||
|
display.addVisual(new FieldDrawer((Field) tile));
|
||||||
tile.putABox(new Box());
|
tile.putABox(new Box());
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'O':
|
case 'O':
|
||||||
tile = new Field();
|
tile = new Field();
|
||||||
|
display.addVisual(new FieldDrawer((Field) tile));
|
||||||
oneilllocation = tile;
|
oneilllocation = tile;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'J':
|
case 'J':
|
||||||
tile = new Field();
|
tile = new Field();
|
||||||
|
display.addVisual(new FieldDrawer((Field) tile));
|
||||||
jaffalocation = tile;
|
jaffalocation = tile;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -100,10 +106,12 @@ public class Dungeon {
|
|||||||
|
|
||||||
case 'X':
|
case 'X':
|
||||||
tile = new Gap();
|
tile = new Gap();
|
||||||
|
display.addVisual(new GapDrawer((Gap) tile));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 'R':
|
case 'R':
|
||||||
tile = new Field();
|
tile = new Field();
|
||||||
|
display.addVisual(new FieldDrawer((Field) tile));
|
||||||
replicatorlocation = tile;
|
replicatorlocation = tile;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -125,10 +133,12 @@ public class Dungeon {
|
|||||||
int triggerweight = Integer.parseInt(scaledata[4]);
|
int triggerweight = Integer.parseInt(scaledata[4]);
|
||||||
|
|
||||||
Gate gate = new Gate();
|
Gate gate = new Gate();
|
||||||
|
display.addVisual(new GateDrawer(gate));
|
||||||
gate.setY(gy);
|
gate.setY(gy);
|
||||||
gate.setX(gx);
|
gate.setX(gx);
|
||||||
|
|
||||||
Scale scale = new Scale(gate, triggerweight);
|
Scale scale = new Scale(gate, triggerweight);
|
||||||
|
display.addVisual(new ScaleDrawer(scale));
|
||||||
scale.setY(sy);
|
scale.setY(sy);
|
||||||
scale.setX(sx);
|
scale.setX(sx);
|
||||||
|
|
||||||
|
@ -32,7 +32,7 @@ public class Game {
|
|||||||
public void startGame(File dungeonFile) throws IOException {
|
public void startGame(File dungeonFile) throws IOException {
|
||||||
Stargate.init();
|
Stargate.init();
|
||||||
|
|
||||||
Map<String, Tile> players = dungeon.buildDungeon(dungeonFile);
|
Map<String, Tile> players = dungeon.buildDungeon(dungeonFile, display);
|
||||||
oneill = new Player("O'Neill", players.get("oneill"), getRandomDirection());
|
oneill = new Player("O'Neill", players.get("oneill"), getRandomDirection());
|
||||||
jaffa = new Player("Jaffa", players.get("jaffa"), getRandomDirection());
|
jaffa = new Player("Jaffa", players.get("jaffa"), getRandomDirection());
|
||||||
replicator = new PlayerBase("Replicator", players.get("replicator"), getRandomDirection());
|
replicator = new PlayerBase("Replicator", players.get("replicator"), getRandomDirection());
|
||||||
|
Loading…
Reference in New Issue
Block a user