diff --git a/cicaprojekt/Dungeon.java b/cicaprojekt/Dungeon.java index 0a0510f..d80d79e 100644 --- a/cicaprojekt/Dungeon.java +++ b/cicaprojekt/Dungeon.java @@ -1,8 +1,12 @@ package cicaprojekt; +import jdk.internal.util.xml.impl.Pair; + import javax.swing.*; +import java.awt.*; import java.io.*; import java.util.HashMap; +import java.util.List; import java.util.Map; public class Dungeon { @@ -60,6 +64,7 @@ public class Dungeon { mapHeight = height; Tile[][] dungeon = new Tile[height][width]; + Map gatescalemap = new HashMap<>(); String line; Gate tempgate = new Gate(); @@ -110,10 +115,16 @@ public class Dungeon { case 'G': tile = tempgate; + AbstractDrawer vg = new GateDrawer((Gate) tile); + display.addVisual(vg); + gatescalemap.put(new Point(x, y), vg); break; case 'S': tile = tempscale; + AbstractDrawer vs = new ScaleDrawer((Scale) tile); + display.addVisual(vs); + gatescalemap.put(new Point(x, y), vs); scalecount++; break; @@ -146,12 +157,12 @@ public class Dungeon { int triggerweight = Integer.parseInt(scaledata[4]); Gate gate = new Gate(); - display.addVisual(new GateDrawer(gate)); + ((GateDrawer)gatescalemap.get(new Point(gx, gy))).setGate(gate); gate.setY(gy); gate.setX(gx); Scale scale = new Scale(gate, triggerweight); - display.addVisual(new ScaleDrawer(scale)); + ((ScaleDrawer)gatescalemap.get(new Point(sx, sy))).setScale(scale); scale.setY(sy); scale.setX(sx);