Move Clyde to the solution folder for day 1 ghost exercise
This commit is contained in:
parent
2db3195df8
commit
88f81cd0ae
9 changed files with 16 additions and 20 deletions
5
exercises/17/classes/solution/Clyde.cpp
Normal file
5
exercises/17/classes/solution/Clyde.cpp
Normal file
|
@ -0,0 +1,5 @@
|
|||
#include "Clyde.hpp"
|
||||
|
||||
namespace pacman {
|
||||
|
||||
} // namespace pacman
|
11
exercises/17/classes/solution/Clyde.hpp
Normal file
11
exercises/17/classes/solution/Clyde.hpp
Normal file
|
@ -0,0 +1,11 @@
|
|||
#pragma once
|
||||
|
||||
#include "Ghost.hpp"
|
||||
|
||||
namespace pacman {
|
||||
|
||||
class Clyde {
|
||||
|
||||
};
|
||||
|
||||
} // namespace pacman
|
|
@ -1,5 +1,4 @@
|
|||
#include "Clyde.hpp"
|
||||
#include "GameState.hpp"
|
||||
|
||||
namespace pacman {
|
||||
|
|
@ -39,7 +39,6 @@ void Canvas::update(const GameState & gameState) {
|
|||
renderGhost(gameState.blinky);
|
||||
renderGhost(gameState.pinky);
|
||||
renderGhost(gameState.inky);
|
||||
renderGhost(gameState.clyde);
|
||||
|
||||
renderScore(gameState.score.points);
|
||||
renderLives(gameState.score.lives);
|
||||
|
|
|
@ -24,15 +24,12 @@ void GameState::step(std::chrono::milliseconds delta) {
|
|||
pinky.update(delta);
|
||||
inky.setTarget(pacMan.positionInGrid(), pacMan.currentDirection(), blinky.positionInGrid());
|
||||
inky.update(delta);
|
||||
clyde.setTarget(pacMan.position());
|
||||
clyde.update(delta);
|
||||
|
||||
fruit.update(delta, score.eatenPellets);
|
||||
|
||||
checkCollision(blinky);
|
||||
checkCollision(pinky);
|
||||
checkCollision(inky);
|
||||
checkCollision(clyde);
|
||||
|
||||
eatPellets();
|
||||
eatFruit();
|
||||
|
@ -61,7 +58,6 @@ void GameState::handleDeathAnimation(std::chrono::milliseconds delta) {
|
|||
blinky.reset();
|
||||
pinky.reset();
|
||||
inky.reset();
|
||||
clyde.reset();
|
||||
pacMan.reset();
|
||||
timeSinceDeath = std::chrono::milliseconds(0);
|
||||
}
|
||||
|
@ -81,7 +77,6 @@ void GameState::eatPellets() {
|
|||
blinky.frighten();
|
||||
pinky.frighten();
|
||||
inky.frighten();
|
||||
clyde.frighten();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "Blinky.hpp"
|
||||
#include "Clyde.hpp"
|
||||
#include "Fruits.hpp"
|
||||
#include "Ghost.hpp"
|
||||
#include "Inky.hpp"
|
||||
|
@ -21,7 +20,6 @@ struct GameState {
|
|||
Blinky blinky;
|
||||
Pinky pinky;
|
||||
Inky inky;
|
||||
Clyde clyde;
|
||||
|
||||
PacMan pacMan;
|
||||
PacManAI pacManAI;
|
||||
|
|
|
@ -1,7 +1,6 @@
|
|||
#pragma once
|
||||
|
||||
#include "Blinky.hpp"
|
||||
#include "Clyde.hpp"
|
||||
#include "Direction.hpp"
|
||||
#include "Inky.hpp"
|
||||
#include "PacMan.hpp"
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
#include "Blinky.hpp"
|
||||
#include "Clyde.hpp"
|
||||
#include "Inky.hpp"
|
||||
#include "Pinky.hpp"
|
||||
#include <catch2/catch.hpp>
|
||||
|
@ -20,9 +19,6 @@ TEST_CASE("Ghosts start in the correct position", "[ghosts]") {
|
|||
pacman::Blinky blinky;
|
||||
ghostInitTest(blinky, 13.5, 11);
|
||||
|
||||
pacman::Clyde clyde;
|
||||
ghostInitTest(clyde, 15.5, 14);
|
||||
|
||||
pacman::Inky inky;
|
||||
ghostInitTest(inky, 13.5, 14);
|
||||
|
||||
|
@ -43,9 +39,6 @@ TEST_CASE("Ghosts are frighten", "[ghosts]") {
|
|||
pacman::Blinky blinky;
|
||||
ghostFrightenTest(blinky);
|
||||
|
||||
pacman::Clyde clyde;
|
||||
ghostFrightenTest(clyde);
|
||||
|
||||
pacman::Inky inky;
|
||||
ghostFrightenTest(inky);
|
||||
|
||||
|
@ -66,9 +59,6 @@ TEST_CASE("Ghosts can die", "[ghosts]") {
|
|||
pacman::Blinky blinky;
|
||||
ghostDeadTest(blinky);
|
||||
|
||||
pacman::Clyde clyde;
|
||||
ghostDeadTest(clyde);
|
||||
|
||||
pacman::Inky inky;
|
||||
ghostDeadTest(inky);
|
||||
|
||||
|
|
Loading…
Reference in a new issue