Move Clyde to the solution folder for day 1 ghost exercise

This commit is contained in:
Patricia Aas 2021-10-05 09:46:29 +02:00
parent 2db3195df8
commit 88f81cd0ae
9 changed files with 16 additions and 20 deletions

View file

@ -0,0 +1,5 @@
#include "Clyde.hpp"
namespace pacman {
} // namespace pacman

View file

@ -0,0 +1,11 @@
#pragma once
#include "Ghost.hpp"
namespace pacman {
class Clyde {
};
} // namespace pacman

View file

@ -1,5 +1,4 @@
#include "Clyde.hpp" #include "Clyde.hpp"
#include "GameState.hpp"
namespace pacman { namespace pacman {

View file

@ -39,7 +39,6 @@ void Canvas::update(const GameState & gameState) {
renderGhost(gameState.blinky); renderGhost(gameState.blinky);
renderGhost(gameState.pinky); renderGhost(gameState.pinky);
renderGhost(gameState.inky); renderGhost(gameState.inky);
renderGhost(gameState.clyde);
renderScore(gameState.score.points); renderScore(gameState.score.points);
renderLives(gameState.score.lives); renderLives(gameState.score.lives);

View file

@ -24,15 +24,12 @@ void GameState::step(std::chrono::milliseconds delta) {
pinky.update(delta); pinky.update(delta);
inky.setTarget(pacMan.positionInGrid(), pacMan.currentDirection(), blinky.positionInGrid()); inky.setTarget(pacMan.positionInGrid(), pacMan.currentDirection(), blinky.positionInGrid());
inky.update(delta); inky.update(delta);
clyde.setTarget(pacMan.position());
clyde.update(delta);
fruit.update(delta, score.eatenPellets); fruit.update(delta, score.eatenPellets);
checkCollision(blinky); checkCollision(blinky);
checkCollision(pinky); checkCollision(pinky);
checkCollision(inky); checkCollision(inky);
checkCollision(clyde);
eatPellets(); eatPellets();
eatFruit(); eatFruit();
@ -61,7 +58,6 @@ void GameState::handleDeathAnimation(std::chrono::milliseconds delta) {
blinky.reset(); blinky.reset();
pinky.reset(); pinky.reset();
inky.reset(); inky.reset();
clyde.reset();
pacMan.reset(); pacMan.reset();
timeSinceDeath = std::chrono::milliseconds(0); timeSinceDeath = std::chrono::milliseconds(0);
} }
@ -81,7 +77,6 @@ void GameState::eatPellets() {
blinky.frighten(); blinky.frighten();
pinky.frighten(); pinky.frighten();
inky.frighten(); inky.frighten();
clyde.frighten();
} }
} }

View file

@ -1,7 +1,6 @@
#pragma once #pragma once
#include "Blinky.hpp" #include "Blinky.hpp"
#include "Clyde.hpp"
#include "Fruits.hpp" #include "Fruits.hpp"
#include "Ghost.hpp" #include "Ghost.hpp"
#include "Inky.hpp" #include "Inky.hpp"
@ -21,7 +20,6 @@ struct GameState {
Blinky blinky; Blinky blinky;
Pinky pinky; Pinky pinky;
Inky inky; Inky inky;
Clyde clyde;
PacMan pacMan; PacMan pacMan;
PacManAI pacManAI; PacManAI pacManAI;

View file

@ -1,7 +1,6 @@
#pragma once #pragma once
#include "Blinky.hpp" #include "Blinky.hpp"
#include "Clyde.hpp"
#include "Direction.hpp" #include "Direction.hpp"
#include "Inky.hpp" #include "Inky.hpp"
#include "PacMan.hpp" #include "PacMan.hpp"

View file

@ -1,5 +1,4 @@
#include "Blinky.hpp" #include "Blinky.hpp"
#include "Clyde.hpp"
#include "Inky.hpp" #include "Inky.hpp"
#include "Pinky.hpp" #include "Pinky.hpp"
#include <catch2/catch.hpp> #include <catch2/catch.hpp>
@ -20,9 +19,6 @@ TEST_CASE("Ghosts start in the correct position", "[ghosts]") {
pacman::Blinky blinky; pacman::Blinky blinky;
ghostInitTest(blinky, 13.5, 11); ghostInitTest(blinky, 13.5, 11);
pacman::Clyde clyde;
ghostInitTest(clyde, 15.5, 14);
pacman::Inky inky; pacman::Inky inky;
ghostInitTest(inky, 13.5, 14); ghostInitTest(inky, 13.5, 14);
@ -43,9 +39,6 @@ TEST_CASE("Ghosts are frighten", "[ghosts]") {
pacman::Blinky blinky; pacman::Blinky blinky;
ghostFrightenTest(blinky); ghostFrightenTest(blinky);
pacman::Clyde clyde;
ghostFrightenTest(clyde);
pacman::Inky inky; pacman::Inky inky;
ghostFrightenTest(inky); ghostFrightenTest(inky);
@ -66,9 +59,6 @@ TEST_CASE("Ghosts can die", "[ghosts]") {
pacman::Blinky blinky; pacman::Blinky blinky;
ghostDeadTest(blinky); ghostDeadTest(blinky);
pacman::Clyde clyde;
ghostDeadTest(clyde);
pacman::Inky inky; pacman::Inky inky;
ghostDeadTest(inky); ghostDeadTest(inky);