paar kleine SchönheitsÃderungen

master
Lenz Wiechers 2020-06-08 14:02:07 +02:00
parent d55e432b06
commit a169f0676a
22 changed files with 40 additions and 52 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -1,4 +1,4 @@
// Diese Klasse stellt die einzelnen Bicks (Wände) auf der Map dar.
// Diese Klasse stellt die BigPoints (punkte die man fressen kann um kurzzeittig die Geister töten zu können) auf der Map dar.
public class BigPoint extends Picture { // Die übergeordnete Klasse ist Picture
@ -8,8 +8,8 @@ public class BigPoint extends Picture { // Die
public int yPos; // Position auf dem Frame in y-Richtung
public BigPoint(int newXPos, int newYPos) { // Erstellen des Konstruktors mit den Koordinaten, an denen sich der
// Brick
// beefinden soll.
// BigPoint
// befinden soll.
super("bigpoint"); // Aufrufen der übergeordneten Klasse

View File

@ -8,7 +8,7 @@ public class Brick extends Picture { // Die
public int yPos; // Position auf dem Frame in y-Richtung
public Brick(int newXPos, int newYPos) { // Erstellen des Konstruktors mit den Koordinaten, an denen sich der Brick
// beefinden soll.
// befinden soll.
super("brick"); // Aufrufen der übergeordneten Klasse

View File

@ -133,7 +133,7 @@ public class Game {
}
}
}
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);
} else {
ghosts[i].setIsDead(false);
ghosts[i].setPos('x', Map.ghost_posX[i]);
@ -184,7 +184,6 @@ public class Game {
dt = System.nanoTime() - lastT; // delta time
lastT = System.nanoTime(); // delta time
player.setLocation(player.getPos('x', dt), player.getPos('y', dt));
for (int i = 0; i < ghosts.length; i++) {
@ -248,8 +247,7 @@ public class Game {
minn = HCost[j];
}
}
for (int j = 0; j < 4; j++) {
if (HCost[j] == minn) {
if (frames % Ghost.offFrames == 0) {
@ -343,22 +341,22 @@ public class Game {
if (Map.Left != null) {
if (player.getPos('x', 0) < Map.Left.xPos + 20 && player.getPos('x', 0) > Map.Left.xPos - 20
&& player.getPos('y', 0) < Map.Left.yPos + 20 && player.getPos('y', 0) > Map.Left.yPos - 20) {
if (Map.Right != null) {
player.xPos = Map.Right.xPos - 20;
player.yPos = Map.Right.yPos;
}
}
}
if (Map.Right != null) {
if (player.getPos('x', 0) < Map.Right.xPos + 20 && player.getPos('x', 0) > Map.Right.xPos - 20
&& player.getPos('y', 0) < Map.Right.yPos + 20 && player.getPos('y', 0) > Map.Right.yPos - 20) {
if (Map.Left != null) {
player.xPos = Map.Left.xPos + 20;
player.yPos = Map.Left.yPos;
}
}
}
@ -414,7 +412,7 @@ public class Game {
ghosts[i].setPos('x', -100);
ghosts[i].setPos('y', -100);
score += 1000;
} else {
player.lives--;
@ -439,8 +437,6 @@ public class Game {
fps = 1000000000 / dt;
delay(delaytimer); // Ein delay zum Ende der Hauptschleife
if (frames % 100 == 0) {

View File

@ -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,8 +71,9 @@ public class Ghost extends Picture { // Die
}
} else {
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))));
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))));
}
return (int) HCost;
@ -118,7 +119,7 @@ public class Ghost extends Picture { // Die
yPos -= 1;
}
return (int) yPos; // (int)
return (int) yPos;
} else {
return -1;
}

View File

@ -1,19 +1,15 @@
// Diese Klasse stellt die einzelnen Bicks (Wände) auf der Map dar.
// Diese Klasse stellt den Hintergrun im MapMenü
public class Hintergrund extends Picture {
public class Hintergrund extends Picture {
private static final long serialVersionUID = -8813034369041822237L;
public int xPos;
public int yPos;
public int xPos;
public int yPos;
public Hintergrund() {
public Hintergrund() {
super("hintergrund");
super("hintergrund");
}
}

View File

@ -1,10 +1,12 @@
// Diese Klasse stellt die Herzen dar.
public class Lives extends Picture {
private static final long serialVersionUID = -4715442447789971450L;
public Lives() {
super("heart");
}
}

View File

@ -22,13 +22,10 @@ public class Main {
// Methode zum verzögern (warten) in ms
public static void delay(int time) {
try {
Thread.sleep(time);
} catch (InterruptedException e) {
e.printStackTrace();
}
}
}
}

View File

@ -46,8 +46,6 @@ public class Map {
reader = new BufferedReader(new FileReader("assets/Maps/" + selectedMap)); // Einlesen der .txt Datei
for (int i = 0; i < 35; i++) { // für die ersten 35 Zeilen der Datei:
String line = reader.readLine(); // Einlesen der jeweiligen Zeile
for (int j = 0; j < 35; j++) { // für die ersten 35 Zeichen der jeweiligen Zeile

View File

@ -71,15 +71,14 @@ public class MapMenu extends JFrame {
}
}
});
bob = new JComboBox<Object>(maps);
bob.setSelectedItem("Original");
panel.add(bob);
bob.setBounds(50, 10, 200, 30);
bob.setFont(new Font("Consolas", Font.PLAIN, 14));
//bob.setAlignmentX(Label.CENTER);
((JLabel)bob.getRenderer()).setHorizontalAlignment(SwingConstants.CENTER);
// bob.setAlignmentX(Label.CENTER);
((JLabel) bob.getRenderer()).setHorizontalAlignment(SwingConstants.CENTER);
}
public String getSelectedMap() {

View File

@ -1,4 +1,4 @@
// Diese Klasse stellt die einzelnen Bicks (Wände) auf der Map dar.
// Diese Klasse stellt die einzelnen Punkte die man einsammeln kann um den Score zu vergrößern dar.
public class Point extends Picture { // Die übergeordnete Klasse ist Picture

View File

@ -1,17 +1,16 @@
// Diese Klasse stellt die einzelnen Bicks (Wände) auf der Map dar.
// Diese Klasse stellt die Portale auf der Map dar.
public class Portal extends Picture {
public class Portal extends Picture {
private static final long serialVersionUID = -8813034369041822237L;
public int xPos;
public int yPos;
public Portal(int newXPos, int newYPos) {
public int xPos;
public int yPos;
public Portal(int newXPos, int newYPos) {
super("portal");
super("portal");
xPos = newXPos;
yPos = newYPos;