always og. bei mapauswahl
parent
abc520f2bc
commit
963c537de6
BIN
bin/Game.class
BIN
bin/Game.class
Binary file not shown.
BIN
bin/Ghost.class
BIN
bin/Ghost.class
Binary file not shown.
|
@ -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,7 +414,6 @@ 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
|
||||
|
||||
|
|
|
@ -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))));
|
||||
}
|
||||
|
||||
|
|
|
@ -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();
|
||||
|
||||
|
|
|
@ -73,7 +73,7 @@ public class MapMenu extends JFrame {
|
|||
});
|
||||
|
||||
bob = new JComboBox<Object>(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);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue