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
|
public class BigPoint extends Picture { // Die übergeordnete Klasse ist Picture
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static final long serialVersionUID = -1204077187616807301L;
|
private static final long serialVersionUID = -1204077187616807301L;
|
||||||
|
|
||||||
|
|
||||||
public int xPos; // Position auf dem Frame in x-Richtung
|
public int xPos; // Position auf dem Frame in x-Richtung
|
||||||
public int yPos; // Position auf dem Frame in y-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.
|
// beefinden soll.
|
||||||
|
|
||||||
super("bigpoint"); // Aufrufen der übergeordneten Klasse
|
super("bigpoint"); // Aufrufen der übergeordneten Klasse
|
||||||
|
|
|
@ -152,7 +152,7 @@ public class Game {
|
||||||
if (ghosts[i].getIsDead()) {
|
if (ghosts[i].getIsDead()) {
|
||||||
if (ghosts[i].getDeathTimer() != 0) {
|
if (ghosts[i].getDeathTimer() != 0) {
|
||||||
ghosts[i].setDeathTimer(ghosts[i].getDeathTimer() - 1);
|
ghosts[i].setDeathTimer(ghosts[i].getDeathTimer() - 1);
|
||||||
System.out.println(ghosts[i].getDeathTimer());
|
// System.out.println(ghosts[i].getDeathTimer());
|
||||||
} else {
|
} else {
|
||||||
ghosts[i].setIsDead(false);
|
ghosts[i].setIsDead(false);
|
||||||
ghosts[i].setPos('x', Map.ghost_posX[i]);
|
ghosts[i].setPos('x', Map.ghost_posX[i]);
|
||||||
|
@ -171,6 +171,7 @@ public class Game {
|
||||||
for (int i = 0; i < ghosts.length; i++) {
|
for (int i = 0; i < ghosts.length; i++) {
|
||||||
ghosts[i].feared = false;
|
ghosts[i].feared = false;
|
||||||
ghosts[i].ogSauce();
|
ghosts[i].ogSauce();
|
||||||
|
Ghost.offFrames = 4;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -246,7 +247,7 @@ public class Game {
|
||||||
// HCost[3]);
|
// HCost[3]);
|
||||||
for (int j = 0; j < 4; j++) {
|
for (int j = 0; j < 4; j++) {
|
||||||
if (HCost[j] == minn) {
|
if (HCost[j] == minn) {
|
||||||
if (frames % 4 == 0) {
|
if (frames % Ghost.offFrames == 0) {
|
||||||
if (j == 0) {
|
if (j == 0) {
|
||||||
ghosts[i].right = true;
|
ghosts[i].right = true;
|
||||||
ghosts[i].left = false;
|
ghosts[i].left = false;
|
||||||
|
@ -353,30 +354,18 @@ public class Game {
|
||||||
Ghost.fearedTimer = 1000;
|
Ghost.fearedTimer = 1000;
|
||||||
ghosts[i].changeSauce("feared");
|
ghosts[i].changeSauce("feared");
|
||||||
if (ghosts[i].left) {
|
if (ghosts[i].left) {
|
||||||
ghosts[i].right = true;
|
ghosts[i].dire = 0;
|
||||||
ghosts[i].left = false;
|
|
||||||
ghosts[i].down = false;
|
|
||||||
ghosts[i].up = false;
|
|
||||||
|
|
||||||
} else if (ghosts[i].right) {
|
} else if (ghosts[i].right) {
|
||||||
ghosts[i].left = true;
|
ghosts[i].dire = 1;
|
||||||
ghosts[i].right = false;
|
|
||||||
ghosts[i].down = false;
|
|
||||||
ghosts[i].up = false;
|
|
||||||
|
|
||||||
} else if (ghosts[i].down) {
|
} else if (ghosts[i].down) {
|
||||||
ghosts[i].up = true;
|
ghosts[i].dire = 3;
|
||||||
ghosts[i].right = false;
|
|
||||||
ghosts[i].left = false;
|
|
||||||
ghosts[i].down = false;
|
|
||||||
|
|
||||||
} else if (ghosts[i].up) {
|
} else if (ghosts[i].up) {
|
||||||
ghosts[i].down = true;
|
ghosts[i].dire = 4;
|
||||||
ghosts[i].right = false;
|
|
||||||
ghosts[i].left = false;
|
|
||||||
ghosts[i].up = false;
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Ghost.offFrames = 6;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,7 @@ public class Ghost extends Picture { // Die
|
||||||
|
|
||||||
public int dire;
|
public int dire;
|
||||||
|
|
||||||
|
public static int offFrames = 4;
|
||||||
public boolean feared;
|
public boolean feared;
|
||||||
public static int fearedTimer;
|
public static int fearedTimer;
|
||||||
private int deathTimer;
|
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
|
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 (coordinate == 'x') { // Auslesen der 'x' - Koordinate:
|
||||||
if (left && dt != 0 && Game.frames % 4 == 0) {
|
if (left && dt != 0 && Game.frames % offFrames == 0) {
|
||||||
|
|
||||||
xPos -= 1;
|
xPos -= 1;
|
||||||
|
|
||||||
} else if (right && dt != 0 && Game.frames % 4 == 0) {
|
} else if (right && dt != 0 && Game.frames % offFrames == 0) {
|
||||||
|
|
||||||
xPos += 1;
|
xPos += 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
return (int) xPos;
|
return (int) xPos;
|
||||||
} else if (coordinate == 'y') { // Auslesen der 'y' - Koordinate:
|
} 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;
|
yPos += 1;
|
||||||
|
|
||||||
} else if (up && dt != 0 && Game.frames % 4 == 0) {
|
} else if (up && dt != 0 && Game.frames % offFrames == 0) {
|
||||||
|
|
||||||
yPos -= 1;
|
yPos -= 1;
|
||||||
|
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
|
|
||||||
|
public class Lives extends Picture {
|
||||||
public class Lives extends Picture{
|
|
||||||
|
|
||||||
private static final long serialVersionUID = -4715442447789971450L;
|
private static final long serialVersionUID = -4715442447789971450L;
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,8 @@
|
||||||
|
|
||||||
public class Point extends Picture { // Die übergeordnete Klasse ist Picture
|
public class Point extends Picture { // Die übergeordnete Klasse ist Picture
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private static final long serialVersionUID = -1204077187616807301L;
|
private static final long serialVersionUID = -1204077187616807301L;
|
||||||
|
|
||||||
|
|
||||||
public int xPos; // Position auf dem Frame in x-Richtung
|
public int xPos; // Position auf dem Frame in x-Richtung
|
||||||
public int yPos; // Position auf dem Frame in y-Richtung
|
public int yPos; // Position auf dem Frame in y-Richtung
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue