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