Use the correct ghost names
This commit is contained in:
parent
0428366e86
commit
d6a046ff47
6 changed files with 11 additions and 11 deletions
|
@ -38,7 +38,7 @@ void Canvas::update(const GameState & gameState, const Score & score) {
|
|||
renderSuperPellets(gameState.superPellets);
|
||||
|
||||
renderGhost(gameState.blinky);
|
||||
renderGhost(gameState.speedy);
|
||||
renderGhost(gameState.pinky);
|
||||
renderGhost(gameState.inky);
|
||||
renderGhost(gameState.clyde);
|
||||
|
||||
|
|
10
lib/Game.cpp
10
lib/Game.cpp
|
@ -53,7 +53,7 @@ void Game::handleDeathAnimation(std::chrono::milliseconds delta) {
|
|||
|
||||
if (timeSinceDeath.count() > 1000) {
|
||||
gameState.blinky.reset();
|
||||
gameState.speedy.reset();
|
||||
gameState.pinky.reset();
|
||||
gameState.inky.reset();
|
||||
gameState.clyde.reset();
|
||||
gameState.pacMan.reset();
|
||||
|
@ -74,12 +74,12 @@ void Game::step(std::chrono::milliseconds delta, InputState inputState) {
|
|||
return;
|
||||
|
||||
gameState.blinky.update(delta);
|
||||
gameState.speedy.update(delta);
|
||||
gameState.pinky.update(delta);
|
||||
gameState.inky.update(delta);
|
||||
gameState.clyde.update(delta);
|
||||
|
||||
checkCollision(gameState.blinky);
|
||||
checkCollision(gameState.speedy);
|
||||
checkCollision(gameState.pinky);
|
||||
checkCollision(gameState.inky);
|
||||
checkCollision(gameState.clyde);
|
||||
|
||||
|
@ -87,7 +87,7 @@ void Game::step(std::chrono::milliseconds delta, InputState inputState) {
|
|||
eatPellets();
|
||||
}
|
||||
|
||||
void Game::checkCollision(Ghost & ghost) {
|
||||
void Game::checkCollision(Ghost ghost) {
|
||||
if (pacManDying() || ghost.isEyes())
|
||||
return;
|
||||
|
||||
|
@ -114,7 +114,7 @@ void Game::eatPellets() {
|
|||
score.points += POWER_PELLET_POINTS;
|
||||
|
||||
gameState.blinky.frighten();
|
||||
gameState.speedy.frighten();
|
||||
gameState.pinky.frighten();
|
||||
gameState.inky.frighten();
|
||||
gameState.clyde.frighten();
|
||||
|
||||
|
|
|
@ -199,7 +199,7 @@ Blinky::Blinky()
|
|||
: Ghost(Atlas::Ghost::blinky, pacman::initialBlinkyPosition(), pacman::blinkyScatterTarget()) {
|
||||
}
|
||||
|
||||
Speedy::Speedy()
|
||||
Pinky::Pinky()
|
||||
: Ghost(Atlas::Ghost::speedy, pacman::initialSpeedyPosition(), pacman::speedyScatterTarget()) {
|
||||
}
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ private:
|
|||
void step(std::chrono::milliseconds delta, InputState inputState);
|
||||
void eatPellets();
|
||||
void processEvents(InputState & inputState);
|
||||
void checkCollision(Ghost & ghost);
|
||||
void checkCollision(Ghost ghost);
|
||||
void killPacMan();
|
||||
bool pacManDying() const;
|
||||
void handleDeathAnimation(std::chrono::milliseconds delta);
|
||||
|
|
|
@ -10,7 +10,7 @@ namespace pacman {
|
|||
|
||||
struct GameState {
|
||||
Blinky blinky;
|
||||
Speedy speedy;
|
||||
Pinky pinky;
|
||||
Inky inky;
|
||||
Clyde clyde;
|
||||
PacMan pacMan;
|
||||
|
|
|
@ -59,9 +59,9 @@ public:
|
|||
explicit Blinky();
|
||||
};
|
||||
|
||||
class Speedy : public Ghost {
|
||||
class Pinky : public Ghost {
|
||||
public:
|
||||
explicit Speedy();
|
||||
explicit Pinky();
|
||||
};
|
||||
|
||||
class Inky : public Ghost {
|
||||
|
|
Loading…
Reference in a new issue