diff --git a/bin/BigPoint.class b/bin/BigPoint.class index c92c3e0..e13d6a9 100644 Binary files a/bin/BigPoint.class and b/bin/BigPoint.class differ diff --git a/bin/Game.class b/bin/Game.class index 510f264..a50dea2 100644 Binary files a/bin/Game.class and b/bin/Game.class differ diff --git a/bin/Ghost.class b/bin/Ghost.class index 57429bd..5f66ca3 100644 Binary files a/bin/Ghost.class and b/bin/Ghost.class differ diff --git a/bin/Lives.class b/bin/Lives.class index f55526b..7394070 100644 Binary files a/bin/Lives.class and b/bin/Lives.class differ diff --git a/bin/Point.class b/bin/Point.class index b863839..c366510 100644 Binary files a/bin/Point.class and b/bin/Point.class differ diff --git a/src/BigPoint.java b/src/BigPoint.java index 9585a7b..af418d3 100644 --- a/src/BigPoint.java +++ b/src/BigPoint.java @@ -2,15 +2,13 @@ public class BigPoint extends Picture { // Die übergeordnete Klasse ist Picture - - private static final long serialVersionUID = -1204077187616807301L; - public int xPos; // Position auf dem Frame in x-Richtung 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 + public BigPoint(int newXPos, int newYPos) { // Erstellen des Konstruktors mit den Koordinaten, an denen sich der + // Brick // beefinden soll. super("bigpoint"); // Aufrufen der übergeordneten Klasse diff --git a/src/Game.java b/src/Game.java index a07f8ff..b6bb5a6 100644 --- a/src/Game.java +++ b/src/Game.java @@ -152,7 +152,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()); + // System.out.println(ghosts[i].getDeathTimer()); } else { ghosts[i].setIsDead(false); ghosts[i].setPos('x', Map.ghost_posX[i]); @@ -171,6 +171,7 @@ public class Game { for (int i = 0; i < ghosts.length; i++) { ghosts[i].feared = false; ghosts[i].ogSauce(); + Ghost.offFrames = 4; } } } @@ -246,7 +247,7 @@ public class Game { // HCost[3]); for (int j = 0; j < 4; j++) { if (HCost[j] == minn) { - if (frames % 4 == 0) { + if (frames % Ghost.offFrames == 0) { if (j == 0) { ghosts[i].right = true; ghosts[i].left = false; @@ -353,30 +354,18 @@ public class Game { Ghost.fearedTimer = 1000; ghosts[i].changeSauce("feared"); if (ghosts[i].left) { - ghosts[i].right = true; - ghosts[i].left = false; - ghosts[i].down = false; - ghosts[i].up = false; - + ghosts[i].dire = 0; } else if (ghosts[i].right) { - ghosts[i].left = true; - ghosts[i].right = false; - ghosts[i].down = false; - ghosts[i].up = false; + ghosts[i].dire = 1; } else if (ghosts[i].down) { - ghosts[i].up = true; - ghosts[i].right = false; - ghosts[i].left = false; - ghosts[i].down = false; + ghosts[i].dire = 3; } else if (ghosts[i].up) { - ghosts[i].down = true; - ghosts[i].right = false; - ghosts[i].left = false; - ghosts[i].up = false; + ghosts[i].dire = 4; } + Ghost.offFrames = 6; } } diff --git a/src/Ghost.java b/src/Ghost.java index c2ca89d..28547a4 100644 --- a/src/Ghost.java +++ b/src/Ghost.java @@ -6,14 +6,15 @@ public class Ghost extends Picture { // Die public float xPos; public float yPos; - + public boolean up; public boolean down; public boolean left; public boolean right; - + public int dire; + public static int offFrames = 4; public boolean feared; public static int fearedTimer; private int deathTimer; @@ -97,22 +98,22 @@ public class Ghost extends Picture { // Die public int getPos(char coordinate, long dt) { // Hier kommt die zuvor erwähnte delta time ins Spiel if (coordinate == 'x') { // Auslesen der 'x' - Koordinate: - if (left && dt != 0 && Game.frames % 4 == 0) { + if (left && dt != 0 && Game.frames % offFrames == 0) { xPos -= 1; - } else if (right && dt != 0 && Game.frames % 4 == 0) { + } else if (right && dt != 0 && Game.frames % offFrames == 0) { xPos += 1; } return (int) xPos; } else if (coordinate == 'y') { // Auslesen der 'y' - Koordinate: - if (down && dt != 0 && Game.frames % 4 == 0) { + if (down && dt != 0 && Game.frames % offFrames == 0) { yPos += 1; - } else if (up && dt != 0 && Game.frames % 4 == 0) { + } else if (up && dt != 0 && Game.frames % offFrames == 0) { yPos -= 1; diff --git a/src/Lives.java b/src/Lives.java index f3be98a..9d04704 100644 --- a/src/Lives.java +++ b/src/Lives.java @@ -1,11 +1,10 @@ +public class Lives extends Picture { -public class Lives extends Picture{ - private static final long serialVersionUID = -4715442447789971450L; public Lives() { super("heart"); } - + } diff --git a/src/Main.java b/src/Main.java index cc91081..d95f039 100644 --- a/src/Main.java +++ b/src/Main.java @@ -5,12 +5,12 @@ public class Main { @SuppressWarnings("unused") // Die "unused" - Warnungen werden in dieser Datei nicht mehr angezeigt - + public static void main(String[] args) { System.setProperty("sun.java2d.opengl", "true"); - Game game = new Game(); // Das Spiel wird gestartet + Game game = new Game(); // Das Spiel wird gestartet } diff --git a/src/Map.java b/src/Map.java index 7494855..b9aa043 100644 --- a/src/Map.java +++ b/src/Map.java @@ -19,12 +19,12 @@ public class Map { public static int ghost_posX[] = new int[4]; public static int ghost_posY[] = new int[4]; - + public static int maxScore; - + public static int pac_posX; public static int pac_posY; - + String line; // String in dem eingelsene Zeilen der Datei gespeichert werden public Map(Player player, Ghost ghosts[]) { // Erstellen des Konstruktors @@ -76,7 +76,7 @@ public class Map { maxScore++; } else if (line.charAt(j) == '.') { bigpoints[i][j] = new BigPoint(10 + 20 * j, 10 + 20 * i); - + } } catch (Exception e) { diff --git a/src/Point.java b/src/Point.java index 87f0412..016289f 100644 --- a/src/Point.java +++ b/src/Point.java @@ -2,11 +2,8 @@ public class Point extends Picture { // Die übergeordnete Klasse ist Picture - - private static final long serialVersionUID = -1204077187616807301L; - public int xPos; // Position auf dem Frame in x-Richtung public int yPos; // Position auf dem Frame in y-Richtung