Ghost movement working - first rev
This commit is contained in:
@ -1,7 +1,9 @@
|
||||
package se.urmo.game.state;
|
||||
|
||||
import lombok.Getter;
|
||||
import se.urmo.game.collision.CollisionChecker;
|
||||
import se.urmo.game.collision.GhostCollisionChecker;
|
||||
import se.urmo.game.entities.BlinkyStrategy;
|
||||
import se.urmo.game.entities.Ghost;
|
||||
import se.urmo.game.entities.PacMan;
|
||||
import se.urmo.game.main.Game;
|
||||
@ -16,19 +18,20 @@ public class PlayingState implements GameState {
|
||||
private final GameStateManager gameStateManager;
|
||||
private final Ghost ghost;
|
||||
private PacMan pacman;
|
||||
@Getter
|
||||
private GameMap map;
|
||||
public PlayingState(Game game, GameStateManager gameStateManager) {
|
||||
this.game = game;
|
||||
this.gameStateManager = gameStateManager;
|
||||
this.map = new GameMap();
|
||||
this.pacman = new PacMan(game, new CollisionChecker(map));
|
||||
this.ghost = new Ghost(game, new GhostCollisionChecker(map), null);
|
||||
this.ghost = new Ghost(game, new GhostCollisionChecker(map), new BlinkyStrategy());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
pacman.update();
|
||||
ghost.update();
|
||||
ghost.update(pacman);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -58,8 +61,4 @@ public class PlayingState implements GameState {
|
||||
pacman.setMoving(false);
|
||||
pacman.setDirection(Direction.NONE);
|
||||
}
|
||||
|
||||
public GameMap getMap() {
|
||||
return map;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user