diff --git a/HeatUp/src/de/heatup/resources/maps/map3.txt b/HeatUp/src/de/heatup/resources/maps/map3.txt new file mode 100644 index 0000000..aec0e6f --- /dev/null +++ b/HeatUp/src/de/heatup/resources/maps/map3.txt @@ -0,0 +1,24 @@ +################################ +################################ +################################ +################################ +################################ +################################ +################################ +################################ +################################ +################################ +################################ +################################ +################################ +################################ +################################ +################################ +################################ +################################ +################################ +################################ +################################ +################################ +################################ +################################ \ No newline at end of file diff --git a/HeatUp/src/de/heatup/resources/maps/map4.txt b/HeatUp/src/de/heatup/resources/maps/map4.txt new file mode 100644 index 0000000..19345ab --- /dev/null +++ b/HeatUp/src/de/heatup/resources/maps/map4.txt @@ -0,0 +1,24 @@ +-------------------------------- +-##############################- +-##############################- +-##############################- +-##############################- +-##############################- +-##############################- +-##############################- +-##############################- +-##############################- +-##############################- +-##############################- +-##############################- +-##############################- +-##############################- +-##############################- +-##############################- +-##############################- +-##############################- +-##############################- +-##############################- +-##############################- +-##############################- +-------------------------------- \ No newline at end of file diff --git a/HeatUp/src/de/heatup/testing/GameLoopD.java b/HeatUp/src/de/heatup/testing/GameLoopD.java index afcf3d5..c662660 100644 --- a/HeatUp/src/de/heatup/testing/GameLoopD.java +++ b/HeatUp/src/de/heatup/testing/GameLoopD.java @@ -108,7 +108,7 @@ public class GameLoopD extends JFrame implements Runnable { kb = new KeyBindings(player01); gamePanel.addKeyListener(kb); - MapEngine me = new MapEngine(1); + MapEngine me = new MapEngine(4); me.addAllToPanel(gamePanel); Point spawnPoint = SpawnAssistant.getPathLocationOnGrid(); @@ -190,7 +190,7 @@ public class GameLoopD extends JFrame implements Runnable { frames++; try { - thread.sleep(1); // entlastet die cpu massiv. + thread.sleep(10); // entlastet die cpu massiv. } catch (InterruptedException e) { // TODO Auto-generated catch block diff --git a/HeatUp/src/de/heatup/testing/Opponent.java b/HeatUp/src/de/heatup/testing/Opponent.java index 1f1f80e..2f4b008 100644 --- a/HeatUp/src/de/heatup/testing/Opponent.java +++ b/HeatUp/src/de/heatup/testing/Opponent.java @@ -27,6 +27,7 @@ public class Opponent extends Player { private boolean blocked = false; private boolean move = false; private int blockedCounter = 0; + private char charDir; public Opponent() { CollisionHandler.addMovingObject(this); @@ -75,7 +76,7 @@ public class Opponent extends Player { // Umentscheiden oder weiter in die vorgegeben Richtung if ( ! this.move ) { - Logger.write("Redeciding..."); + //Logger.write("Redeciding..."); this.d = (rand.nextInt(10) <= 4) ? 'x' : 'y'; this.i = (rand.nextInt(10) <= 4) ? 1 : -1; // Sicher stellen das man nicht in die Richtung geht aus der man gekommen ist. @@ -91,7 +92,7 @@ public class Opponent extends Player { // Blockade auflösen, gehe doch in die Richtung aus man gekommen ist if ( this.blocked ) { - Logger.write("Warning: Block detected!"); + //Logger.write("Warning: Block detected!"); this.i *= -1; this.move = false; this.blocked = false; @@ -106,7 +107,20 @@ public class Opponent extends Player { testY=this.getGridLocation().y + i; testX=this.getGridLocation().x; } - + + // Umwandeln der numerischen Darstellung der Richtung und CollisionHandler verständlich Angabe +// charDir = ( d == 'x' && i == -1 ) ? 'l' : 'r'; +// charDir = ( d == 'y' && i == -1 ) ? 'u' : 'd'; +// if (CollisionHandler.checkCollision(this, charDir)) { +// System.out.println("Kollision!"); +// this.setGridLocation(testX, testY); +// this.prevd = d; +// this.previ = i; +// redecide = false; +// animate = true; +// break; +// } + // Testen ob die gewählte Richtung begehbar ist if (MapGrid.getGridCell(testX,testY).isPath()) { this.setGridLocation(testX, testY);