Added remaining ghosts incl. movment-strategies

This commit is contained in:
Urban Modig
2025-08-20 15:26:06 +02:00
parent 9f316e5b43
commit 8e546fe942
13 changed files with 129 additions and 32 deletions

View File

@ -7,14 +7,14 @@ import java.awt.Point;
public class PinkyStrategy implements GhostStrategy{
@Override
public Point chooseTarget(PacMan pacman, GameMap map) {
public Point chooseTarget(Ghost ghost, PacMan pacman, GameMap map) {
Direction pacmanDir = pacman.getDirection();
Point pacmanPos = pacman.getTilePosition();
return switch (pacmanDir){
case RIGHT -> new Point(pacmanPos.x + 4 * GameMap.MAP_TILESIZE, pacmanPos.y);
case LEFT -> new Point(pacmanPos.x - 4 * GameMap.MAP_TILESIZE, pacmanPos.y);
case DOWN -> new Point(pacmanPos.x, pacmanPos.y + 4 * GameMap.MAP_TILESIZE);
case UP -> new Point(pacmanPos.x, pacmanPos.y - 4 * GameMap.MAP_TILESIZE);
case RIGHT -> new Point(pacmanPos.x + 8 * GameMap.MAP_TILESIZE, pacmanPos.y);
case LEFT -> new Point(pacmanPos.x - 8 * GameMap.MAP_TILESIZE, pacmanPos.y);
case DOWN -> new Point(pacmanPos.x, pacmanPos.y + 8 * GameMap.MAP_TILESIZE);
case UP -> new Point(pacmanPos.x, pacmanPos.y - 8 * GameMap.MAP_TILESIZE);
case NONE -> pacmanPos;
};
}