implemeted Replicator "AI", it now moves around randomly in a fixed rate

This commit is contained in:
Kjistóf 2016-05-13 22:00:49 +02:00
parent 4aa307a254
commit b732413631

View File

@ -1,5 +1,6 @@
package cicaprojekt;
import java.util.Random;
import java.util.Timer;
import java.util.TimerTask;
@ -8,15 +9,24 @@ public class FlowOfTime extends Timer {
private long gametime;
private class GameOver extends TimerTask {
@Override
public void run() {
Game.instance.stopGame(GameoverCause.TIMEOUT);
}
}
private class ReplicatorAI extends TimerTask {
@Override
public void run()
{
Game.instance.moveReplicator(Direction.getRandom());
Game.instance.updateDisplay();
}
}
public void start(long delay) {
schedule(new GameOver(), delay);
scheduleAtFixedRate(new ReplicatorAI(), 0, 2000);
}
public void stopTime() {