diff --git a/bin/Game.class b/bin/Game.class index 2d0ff96..2075519 100644 Binary files a/bin/Game.class and b/bin/Game.class differ diff --git a/bin/Ghost.class b/bin/Ghost.class index 5f66ca3..57a4a34 100644 Binary files a/bin/Ghost.class and b/bin/Ghost.class differ diff --git a/src/Game.java b/src/Game.java index dc7ef47..ae337a3 100644 --- a/src/Game.java +++ b/src/Game.java @@ -133,7 +133,7 @@ public class Game { } } } - System.out.println(Map.Left + " " + Map.Right); + if (Map.Left != null && Map.Right != null) { panel.add(Map.Left); panel.add(Map.Right); @@ -158,7 +158,7 @@ public class Game { if (ghosts[i].getIsDead()) { if (ghosts[i].getDeathTimer() != 0) { ghosts[i].setDeathTimer(ghosts[i].getDeathTimer() - 1); - // System.out.println(ghosts[i].getDeathTimer()); + } else { ghosts[i].setIsDead(false); ghosts[i].setPos('x', Map.ghost_posX[i]); @@ -184,8 +184,7 @@ public class Game { dt = System.nanoTime() - lastT; // delta time lastT = System.nanoTime(); // delta time - // Zu Beginn jeden Schleifendurchlaufs wird die Position von Pac-Man neu - // gesetzt: + player.setLocation(player.getPos('x', dt), player.getPos('y', dt)); for (int i = 0; i < ghosts.length; i++) { @@ -249,8 +248,8 @@ public class Game { minn = HCost[j]; } } - // System.out.println(HCost[0] + " " + HCost[1] + " " + HCost[2] + " " + - // HCost[3]); + + for (int j = 0; j < 4; j++) { if (HCost[j] == minn) { if (frames % Ghost.offFrames == 0) { @@ -415,8 +414,7 @@ public class Game { ghosts[i].setPos('x', -100); ghosts[i].setPos('y', -100); score += 1000; - System.out.println("Geist" + i + " ist gestorben" + ghosts[i].getIsDead()); - + } else { player.lives--; @@ -441,7 +439,7 @@ public class Game { fps = 1000000000 / dt; - // System.out.println("fps: " + fps); + delay(delaytimer); // Ein delay zum Ende der Hauptschleife diff --git a/src/Ghost.java b/src/Ghost.java index 28547a4..6f5b4d0 100644 --- a/src/Ghost.java +++ b/src/Ghost.java @@ -63,7 +63,7 @@ public class Ghost extends Picture { // Die .sqrt(Math.pow((((xPos - 10) / 20) + mod_x) - ((player.getPos('x', 0) - 10 + 80) / 20), 2) + Math.pow((((yPos - 10) / 20) + mod_y) - ((player.getPos('y', 0) - 10) / 20), 2)); } else if (type == 2) { - HCost = (int) Math.sqrt(Math.pow((((xPos - 10) / 20) + mod_x) - ((200 - 10 + 80) / 20), 2) + HCost = (int) Math.sqrt(Math.pow((((xPos - 10) / 20) + mod_x) - ((200 - 10 + 80) / 20), 2) + Math.pow((((yPos - 10) / 20) + mod_y) - ((200 - 10) / 20), 2)); } else if (type == 3) { HCost = (int) Math.sqrt(Math.pow((((xPos - 10) / 20) + mod_x) - ((player.getPos('x', 0) - 10) / 20), 2) @@ -71,7 +71,7 @@ public class Ghost extends Picture { // Die } } else { - HCost = 10 * (1 / (Math.sqrt(Math.pow((((xPos - 10) / 20) + mod_x) - ((player.getPos('x', 0) - 10) / 20), 2) + HCost = 100 * (1 / (Math.sqrt(Math.pow((((xPos - 10) / 20) + mod_x) - ((player.getPos('x', 0) - 10) / 20), 2) + Math.pow((((yPos - 10) / 20) + mod_y) - ((player.getPos('y', 0) - 10) / 20), 2)))); } diff --git a/src/Main.java b/src/Main.java index a00b1a1..8630b62 100644 --- a/src/Main.java +++ b/src/Main.java @@ -10,7 +10,7 @@ public class Main { System.setProperty("sun.java2d.opengl", "true"); - // Game game = new Game("map1.txt"); // Das Spiel wird gestartet + MapMenu menu = new MapMenu(); diff --git a/src/MapMenu.java b/src/MapMenu.java index 6712d7c..fb43125 100644 --- a/src/MapMenu.java +++ b/src/MapMenu.java @@ -71,9 +71,9 @@ public class MapMenu extends JFrame { } } }); - + bob = new JComboBox(maps); - bob.setSelectedIndex(4); + bob.setSelectedItem("Original"); panel.add(bob); bob.setBounds(70, 10, 120, 30); @@ -86,7 +86,7 @@ public class MapMenu extends JFrame { // Was passieren soll, wenn der Button gedrückt wird public void button_ActionPerformed(ActionEvent evt) throws SQLException { selectedMap = String.valueOf(bob.getSelectedItem()); - System.out.println(selectedMap + " is now the selected Map!"); + rdy = true; this.setVisible(false); }