geister speed angespasst
parent
534748e313
commit
6019d55836
Binary file not shown.
BIN
bin/Game.class
BIN
bin/Game.class
Binary file not shown.
BIN
bin/Ghost.class
BIN
bin/Ghost.class
Binary file not shown.
BIN
bin/Lives.class
BIN
bin/Lives.class
Binary file not shown.
BIN
bin/Point.class
BIN
bin/Point.class
Binary file not shown.
|
@ -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
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
|
||||
public class Lives extends Picture {
|
||||
|
||||
public class Lives extends Picture{
|
||||
|
||||
private static final long serialVersionUID = -4715442447789971450L;
|
||||
|
||||
public Lives() {
|
||||
super("heart");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -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
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -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) {
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Loading…
Reference in New Issue