|
Pacman Torben Petré
|
#include <World.h>


Public Member Functions | |
| World (const std::shared_ptr< AbstractFactory > &factory, int lives) | |
| Creates a World instance. Creating an instance does nothing on its own. | |
| float | getWidth () const |
| Returns the width of the currently loaded map (width is in tiles). | |
| float | getHeight () const |
| Returns the height of the currently loaded map (width is in tiles). | |
| int | getGhostExitX () const |
| Exit coordinates are the coordinates specified on the map which Ghosts must go to in their exiting state. | |
| int | getGhostExitY () const |
| Exit coordinates are the coordinates specified on the map which Ghosts must go to in their exiting state. | |
| std::shared_ptr< PacmanModel > | getPacman () const |
| unsigned int | getLives () const |
| The current amount of lives that Pacman has remaining. | |
| std::pair< float, float > | getCollissionCoordinates () const |
| Pair that holds the X and Y coordinates of the last collission registered by the World. | |
| float | normalizeX (int value) const |
| Normalizes Grid coordinates on a [-1, 1] bounded coordinate system. | |
| float | normalizeY (int value) const |
| Normalizes Grid coordinates on a [-1, 1] bounded coordinate system. | |
| bool | collidesWithWall (float normalizedX, float normalizedY, bool passDoor) const |
| Checks whether the provided coordinates collide with a wall. Takes door Wall types into consideration. | |
| void | loadMap (const std::string &path) |
| Loads any map that is in a rectangular format and follows the specific ASCII formatting. Letters are linked to specific entities. So certain gibberish is unloadable. | |
| void | update (double dt) |
| World Update function. Calls specific helper methods based on the current World state (RESTARTING, FRIGHTENED, PLAYING). | |
| void | handleMove (const Moves &move) const |
| Passes a move down to Pacman. | |
| void | killPacman () |
| Kills Pacman, subtracts a live and puts the World in RESTARTING state. | |
| Public Member Functions inherited from logic::Subject | |
| virtual | ~Subject ()=default |
| void | attach (const std::shared_ptr< Observer > &observer) |
| Attaches an observer to this Subject. | |
| void | notify (Events event) |
| Call the Observer update function with the provided event. | |
Additional Inherited Members | |
| Protected Attributes inherited from logic::Subject | |
| std::list< std::weak_ptr< Observer > > | observers |
|
explicit |
Creates a World instance. Creating an instance does nothing on its own.
| factory | Concere implementation of AbstractFactory. |
| lives | Amount of lives that Pacman will begin with. |
|
nodiscard |
Checks whether the provided coordinates collide with a wall. Takes door Wall types into consideration.
| normalizedX | |
| normalizedY | |
| passDoor | Whether doors may be seen non-colliding. |
|
nodiscard |
Pair that holds the X and Y coordinates of the last collission registered by the World.
|
nodiscard |
Exit coordinates are the coordinates specified on the map which Ghosts must go to in their exiting state.
|
nodiscard |
Exit coordinates are the coordinates specified on the map which Ghosts must go to in their exiting state.
|
nodiscard |
Returns the height of the currently loaded map (width is in tiles).
|
nodiscard |
The current amount of lives that Pacman has remaining.
|
nodiscard |
|
nodiscard |
Returns the width of the currently loaded map (width is in tiles).
| void World::handleMove | ( | const Moves & | move | ) | const |
Passes a move down to Pacman.
| move | Move |
| void World::killPacman | ( | ) |
Kills Pacman, subtracts a live and puts the World in RESTARTING state.
| void World::loadMap | ( | const std::string & | path | ) |
Loads any map that is in a rectangular format and follows the specific ASCII formatting. Letters are linked to specific entities. So certain gibberish is unloadable.
B - Blinky P - Pinky I - Inky C - Clyde t b r e f h i j k l m u o p 1 2 3 4 5 6 d a c g n - Specific wall pieces
| path | Path to file |
|
nodiscard |
Normalizes Grid coordinates on a [-1, 1] bounded coordinate system.
| value | Grid X value |
|
nodiscard |
Normalizes Grid coordinates on a [-1, 1] bounded coordinate system.
| value | Grid Y value |
| void World::update | ( | double | dt | ) |