2021-07-28 13:28:36 +00:00
|
|
|
#include "Blinky.hpp"
|
|
|
|
|
|
|
|
namespace pacman {
|
|
|
|
|
|
|
|
Blinky::Blinky()
|
2021-07-28 13:41:32 +00:00
|
|
|
: Ghost(Atlas::Ghost::blinky, initialBlinkyPosition()) {
|
2021-07-28 13:28:36 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
double Blinky::speed(const GameState & gameState) const {
|
|
|
|
if (state == State::Eyes)
|
|
|
|
return 2;
|
|
|
|
if (state == State::Frightened)
|
|
|
|
return 0.5;
|
|
|
|
return 0.75;
|
|
|
|
}
|
|
|
|
|
|
|
|
Position Blinky::target(const GameState & gameState) const {
|
|
|
|
if (state == State::Eyes)
|
|
|
|
return startingPosition;
|
|
|
|
|
|
|
|
if (isInPen())
|
2021-07-28 13:41:32 +00:00
|
|
|
return penDoorPosition();
|
2021-07-28 13:28:36 +00:00
|
|
|
|
|
|
|
return blinkyScatterTarget();
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|