mirror of
https://github.com/dylanbenzi/pacmen-sfml.git
synced 2026-11-27 08:26:59 +00:00
add ghost specific classes and temporarily remove sound
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
#include "Blinky.h"
|
||||
|
||||
void Blinky::setTargetTile() {
|
||||
|
||||
};
|
||||
@@ -0,0 +1,11 @@
|
||||
#ifndef BLINKY_H
|
||||
#define BLINKY_H
|
||||
|
||||
#include "Ghost.h"
|
||||
|
||||
class Blinky : public Ghost {
|
||||
public:
|
||||
void setTargetTile() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,5 @@
|
||||
#include "Clyde.h"
|
||||
|
||||
void Clyde::setTargetTile() {
|
||||
|
||||
};
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
#ifndef CLYDE_H
|
||||
#define CLYDE_H
|
||||
|
||||
#include "Ghost.h"
|
||||
|
||||
class Clyde : public Ghost {
|
||||
public:
|
||||
void setTargetTile() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
+12
-8
@@ -8,7 +8,11 @@
|
||||
#include <stdexcept>
|
||||
|
||||
#include "Game.h"
|
||||
#include "Blinky.h"
|
||||
#include "Clyde.h"
|
||||
#include "Inky.h"
|
||||
#include "MazeMap.h"
|
||||
#include "Pinky.h"
|
||||
#include "ResourceManager.h"
|
||||
#include "Pacman.h"
|
||||
#include "Ghost.h"
|
||||
@@ -91,10 +95,10 @@ void Game::run() {
|
||||
|
||||
Pacman pacman;
|
||||
|
||||
Ghost blinky;
|
||||
Ghost pinky;
|
||||
Ghost inky;
|
||||
Ghost clyde;
|
||||
Blinky blinky;
|
||||
Pinky pinky;
|
||||
Inky inky;
|
||||
Clyde clyde;
|
||||
|
||||
pacman.setAnimationTiles(resources.getTexture("all_textures"), {1824, 0}, "right_walking", {60, 60}, 2, 0);
|
||||
pacman.setAnimationTiles(resources.getTexture("all_textures"), {1824, 64}, "left_walking", {60, 60}, 2, 0);
|
||||
@@ -143,7 +147,7 @@ void Game::run() {
|
||||
auto window = sf::RenderWindow(sf::VideoMode(windowRes), windowName);
|
||||
|
||||
sf::Sound sound(*resources.getSound("start"));
|
||||
sound.play();
|
||||
//sound.play();
|
||||
|
||||
sf::Sound pellet0(*resources.getSound("eat_dot_0"));
|
||||
sf::Sound pellet1(*resources.getSound("eat_dot_1"));
|
||||
@@ -339,16 +343,16 @@ void Game::run() {
|
||||
break;
|
||||
case PelletType::ENERGIZER:
|
||||
score += 50;
|
||||
fright.play();
|
||||
//fright.play();
|
||||
break;
|
||||
};
|
||||
|
||||
scoreText.setString(std::to_string(score));
|
||||
|
||||
if (pelletSoundCount % 2) {
|
||||
pellet1.play();
|
||||
//pellet1.play();
|
||||
} else {
|
||||
pellet0.play();
|
||||
//pellet0.play();
|
||||
}
|
||||
|
||||
pelletSoundCount++;
|
||||
|
||||
+5
-1
@@ -2,9 +2,13 @@
|
||||
#define GHOST_H
|
||||
|
||||
#include "Entity.h"
|
||||
#include <SFML/System/Vector2.hpp>
|
||||
|
||||
class Ghost : public Entity {
|
||||
|
||||
public:
|
||||
virtual void setTargetTile() = 0;
|
||||
protected:
|
||||
sf::Vector2i targetTile;
|
||||
};
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
#include "Inky.h"
|
||||
|
||||
void Inky::setTargetTile() {
|
||||
|
||||
};
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
#ifndef INKY_H
|
||||
#define INKY_H
|
||||
|
||||
#include "Ghost.h"
|
||||
|
||||
class Inky : public Ghost {
|
||||
public:
|
||||
void setTargetTile() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
@@ -0,0 +1,5 @@
|
||||
#include "Pinky.h"
|
||||
|
||||
void Pinky::setTargetTile() {
|
||||
|
||||
};
|
||||
+11
@@ -0,0 +1,11 @@
|
||||
#ifndef PINKY_H
|
||||
#define PINKY_H
|
||||
|
||||
#include "Ghost.h"
|
||||
|
||||
class Pinky : public Ghost {
|
||||
public:
|
||||
void setTargetTile() override;
|
||||
};
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user