now ending outcomes of the game work purrfectly
This commit is contained in:
parent
cb99f84ded
commit
1a2d0fdfeb
@ -18,4 +18,9 @@ public class FlowOfTime extends Timer {
|
|||||||
public void start(long delay) {
|
public void start(long delay) {
|
||||||
schedule(new GameOver(), delay);
|
schedule(new GameOver(), delay);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void stopTime() {
|
||||||
|
cancel();
|
||||||
|
purge();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -84,10 +84,12 @@ public class Game {
|
|||||||
|
|
||||||
public void moveONeill(Direction direction) {
|
public void moveONeill(Direction direction) {
|
||||||
oneill.move(direction);
|
oneill.move(direction);
|
||||||
|
checkZPMStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void moveJaffa(Direction direction) {
|
public void moveJaffa(Direction direction) {
|
||||||
jaffa.move(direction);
|
jaffa.move(direction);
|
||||||
|
checkZPMStatus();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void rotateOneillLeft() {
|
public void rotateOneillLeft() {
|
||||||
@ -136,4 +138,18 @@ public class Game {
|
|||||||
Control.ioErrorMessage();
|
Control.ioErrorMessage();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void checkZPMStatus()
|
||||||
|
{
|
||||||
|
if (oneill.getZPMCount() >= dungeon.getZPMsToWin())
|
||||||
|
{
|
||||||
|
flowoftime.stopTime();
|
||||||
|
stopGame(GameoverCause.ONEILLWON);
|
||||||
|
}
|
||||||
|
else if (jaffa.getZPMCount() >= dungeon.getZPMsToWin())
|
||||||
|
{
|
||||||
|
flowoftime.stopTime();
|
||||||
|
stopGame(GameoverCause.JAFFAWON);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
5x5
|
5x5
|
||||||
10
|
100
|
||||||
|
|
||||||
W W W W W
|
W W W W W
|
||||||
W O B S W
|
W O B S W
|
||||||
|
@ -1,9 +1,9 @@
|
|||||||
5x5
|
5x5
|
||||||
5
|
150
|
||||||
|
|
||||||
W W W W W
|
W W W W W
|
||||||
W F F F W
|
W F F F W
|
||||||
W F O F W
|
W F O F W
|
||||||
W F F F W
|
W F F Z W
|
||||||
W W W W W
|
W W W W W
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user