Ghost WIP
This commit is contained in:
@ -1,6 +1,8 @@
|
||||
package se.urmo.game.state;
|
||||
|
||||
import se.urmo.game.collision.CollisionChecker;
|
||||
import se.urmo.game.collision.GhostCollisionChecker;
|
||||
import se.urmo.game.entities.Ghost;
|
||||
import se.urmo.game.entities.PacMan;
|
||||
import se.urmo.game.main.Game;
|
||||
import se.urmo.game.map.GameMap;
|
||||
@ -12,6 +14,7 @@ import java.awt.event.KeyEvent;
|
||||
public class PlayingState implements GameState {
|
||||
private final Game game;
|
||||
private final GameStateManager gameStateManager;
|
||||
private final Ghost ghost;
|
||||
private PacMan pacman;
|
||||
private GameMap map;
|
||||
public PlayingState(Game game, GameStateManager gameStateManager) {
|
||||
@ -19,17 +22,20 @@ public class PlayingState implements GameState {
|
||||
this.gameStateManager = gameStateManager;
|
||||
this.map = new GameMap();
|
||||
this.pacman = new PacMan(game, new CollisionChecker(map));
|
||||
this.ghost = new Ghost(game, new GhostCollisionChecker(map));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
pacman.update();
|
||||
ghost.update();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void render(Graphics2D g) {
|
||||
map.draw(g);
|
||||
pacman.draw(g);
|
||||
ghost.draw(g);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user