pacman/lib/Inky.cpp

27 lines
493 B
C++
Raw Normal View History

2021-07-28 13:28:36 +00:00
#include "Inky.hpp"
namespace pacman {
Inky::Inky()
2021-07-28 13:30:53 +00:00
: Ghost(Atlas::Ghost::inky, pacman::initialInkyPosition()) {
2021-07-28 13:28:36 +00:00
}
double Inky::speed(const GameState & gameState) const {
if (state == State::Eyes)
return 2;
if (state == State::Frightened)
return 0.5;
return 0.75;
}
Position Inky::target(const GameState & gameState) const {
if (state == State::Eyes)
return startingPosition;
if (isInPen())
return pacman::penDoorPosition();
return inkyScatterTarget();
}
}