Neue Karten

This commit is contained in:
andreas
2014-11-11 13:10:30 +01:00
parent 0d76bfdc02
commit 3315d41145
4 changed files with 67 additions and 5 deletions
@@ -0,0 +1,24 @@
################################
################################
################################
################################
################################
################################
################################
################################
################################
################################
################################
################################
################################
################################
################################
################################
################################
################################
################################
################################
################################
################################
################################
################################
@@ -0,0 +1,24 @@
--------------------------------
-##############################-
-##############################-
-##############################-
-##############################-
-##############################-
-##############################-
-##############################-
-##############################-
-##############################-
-##############################-
-##############################-
-##############################-
-##############################-
-##############################-
-##############################-
-##############################-
-##############################-
-##############################-
-##############################-
-##############################-
-##############################-
-##############################-
--------------------------------
+2 -2
View File
@@ -108,7 +108,7 @@ public class GameLoopD extends JFrame implements Runnable {
kb = new KeyBindings(player01); kb = new KeyBindings(player01);
gamePanel.addKeyListener(kb); gamePanel.addKeyListener(kb);
MapEngine me = new MapEngine(1); MapEngine me = new MapEngine(4);
me.addAllToPanel(gamePanel); me.addAllToPanel(gamePanel);
Point spawnPoint = SpawnAssistant.getPathLocationOnGrid(); Point spawnPoint = SpawnAssistant.getPathLocationOnGrid();
@@ -190,7 +190,7 @@ public class GameLoopD extends JFrame implements Runnable {
frames++; frames++;
try { try {
thread.sleep(1); // entlastet die cpu massiv. thread.sleep(10); // entlastet die cpu massiv.
} catch (InterruptedException e) { } catch (InterruptedException e) {
// TODO Auto-generated catch block // TODO Auto-generated catch block
+16 -2
View File
@@ -27,6 +27,7 @@ public class Opponent extends Player {
private boolean blocked = false; private boolean blocked = false;
private boolean move = false; private boolean move = false;
private int blockedCounter = 0; private int blockedCounter = 0;
private char charDir;
public Opponent() { public Opponent() {
CollisionHandler.addMovingObject(this); CollisionHandler.addMovingObject(this);
@@ -75,7 +76,7 @@ public class Opponent extends Player {
// Umentscheiden oder weiter in die vorgegeben Richtung // Umentscheiden oder weiter in die vorgegeben Richtung
if ( ! this.move ) { if ( ! this.move ) {
Logger.write("Redeciding..."); //Logger.write("Redeciding...");
this.d = (rand.nextInt(10) <= 4) ? 'x' : 'y'; this.d = (rand.nextInt(10) <= 4) ? 'x' : 'y';
this.i = (rand.nextInt(10) <= 4) ? 1 : -1; this.i = (rand.nextInt(10) <= 4) ? 1 : -1;
// Sicher stellen das man nicht in die Richtung geht aus der man gekommen ist. // 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 // Blockade auflösen, gehe doch in die Richtung aus man gekommen ist
if ( this.blocked ) { if ( this.blocked ) {
Logger.write("Warning: Block detected!"); //Logger.write("Warning: Block detected!");
this.i *= -1; this.i *= -1;
this.move = false; this.move = false;
this.blocked = false; this.blocked = false;
@@ -107,6 +108,19 @@ public class Opponent extends Player {
testX=this.getGridLocation().x; 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 // Testen ob die gewählte Richtung begehbar ist
if (MapGrid.getGridCell(testX,testY).isPath()) { if (MapGrid.getGridCell(testX,testY).isPath()) {
this.setGridLocation(testX, testY); this.setGridLocation(testX, testY);