2020-02-17 16:29:50 +01:00
|
|
|
|
// Diese Klasse stellt die einzelnen Geister dar.
|
|
|
|
|
|
|
|
|
|
public class Ghost extends Picture { // Die <20>bergeordnete Klasse ist Picture
|
|
|
|
|
|
|
|
|
|
private static final long serialVersionUID = -5352006665147359473L;
|
|
|
|
|
|
|
|
|
|
private int xPos;
|
|
|
|
|
private int yPos;
|
|
|
|
|
|
|
|
|
|
public Ghost(int index) {
|
|
|
|
|
|
|
|
|
|
super("Pinky"); // Aufrufen der <20>bergeordneten Klasse
|
|
|
|
|
|
2020-04-30 21:18:21 +02:00
|
|
|
|
// xPos = 150 + 40 * index;
|
2020-02-17 16:29:50 +01:00
|
|
|
|
|
|
|
|
|
if (index == 0) {
|
|
|
|
|
this.changeSauce("Blinky");
|
|
|
|
|
} else if (index == 2) {
|
|
|
|
|
this.changeSauce("Inky");
|
|
|
|
|
} else if (index == 3) {
|
|
|
|
|
this.changeSauce("Clyde");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public int getPos(char coordinate, long dt) {
|
|
|
|
|
if (coordinate == 'x') {
|
|
|
|
|
return xPos;
|
|
|
|
|
} else if (coordinate == 'y') {
|
|
|
|
|
return yPos;
|
|
|
|
|
} else
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void setPos(char coordinate, int newPos) {
|
|
|
|
|
if (coordinate == 'x') {
|
|
|
|
|
xPos = newPos;
|
2020-04-30 21:18:21 +02:00
|
|
|
|
} else if (coordinate == 'y') {
|
2020-02-17 16:29:50 +01:00
|
|
|
|
yPos = newPos;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|