#include <PacmanModel.h>
|
| | PacmanModel (float normalizedX, float normalizedY, float mapWidth, float mapHeight) |
| Moves | getNextDirection () const |
| | Pacman works with input buffering, this function returns the buffered direction.
|
| bool | isMoving () const |
| void | setNextDirection (const Moves &move) |
| | Update the direction of Pacman. This move is buffed if Pacman can not currently move in this direction. The moment it can, it will.
|
| void | move (const World &world, float dt) override |
| | This function is to be called inside the World loop. Moves Pacman in its current direction. Will change that direction if possible.
|
| void | respawn () override |
| | Tell Pacman to respawn. It will go back to its spawnpoint and change everything back to their default values.
|
| | MovingEntityModel (float normalizedX, float normalizedY, float mapWidth, float mapHeight, float speed) |
| | Subclass of EntityModel to be used for any moving entity.
|
| Moves | getDirection () const |
| | Get the direction the entity is currently moving in.
|
| int | getGridX () const |
| int | getGridY () const |
| | EntityModel (float normalizedX, float normalizedY) |
| | Base class for entities.
|
| | ~EntityModel () override=default |
| float | getX () const |
| float | getY () const |
| 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.
|
◆ PacmanModel()
| PacmanModel::PacmanModel |
( |
float | normalizedX, |
|
|
float | normalizedY, |
|
|
float | mapWidth, |
|
|
float | mapHeight ) |
- Parameters
-
| normalizedX | Normalized X spawn coordinate |
| normalizedY | Normalized Y spawn coordinate |
| mapWidth | Width of map (in tiles) |
| mapHeight | Width of map (in tiles) |
◆ getNextDirection()
| Moves PacmanModel::getNextDirection |
( |
| ) |
const |
|
nodiscard |
Pacman works with input buffering, this function returns the buffered direction.
- Returns
- Buffered direction
◆ isMoving()
| bool PacmanModel::isMoving |
( |
| ) |
const |
|
nodiscard |
- Returns
- Whether Pacman is moving
◆ move()
| void PacmanModel::move |
( |
const World & | world, |
|
|
float | dt ) |
|
overridevirtual |
This function is to be called inside the World loop. Moves Pacman in its current direction. Will change that direction if possible.
- Parameters
-
| world | World |
| dt | Deltatime since last call |
Implements logic::MovingEntityModel.
◆ respawn()
| void PacmanModel::respawn |
( |
| ) |
|
|
overridevirtual |
Tell Pacman to respawn. It will go back to its spawnpoint and change everything back to their default values.
Implements logic::MovingEntityModel.
◆ setNextDirection()
| void PacmanModel::setNextDirection |
( |
const Moves & | move | ) |
|
Update the direction of Pacman. This move is buffed if Pacman can not currently move in this direction. The moment it can, it will.
- Parameters
-
The documentation for this class was generated from the following files: