Pacman Torben Petré
Loading...
Searching...
No Matches
logic::WallModel Class Referencefinal

#include <WallModel.h>

Inheritance diagram for logic::WallModel:
Collaboration diagram for logic::WallModel:

Public Member Functions

 WallModel (float normalizedX, float normalizedY, bool isDoor)
 Constructs a WallModel instance.
bool isDoor () const
 Returns whether this wall piece is a door. Doors are walls that can be passed through by ghosts under certain conditions.
Public Member Functions inherited from logic::EntityModel
 EntityModel (float normalizedX, float normalizedY)
 Base class for entities.
 ~EntityModel () override=default
float getX () const
float getY () const
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::EntityModel
float x
float y
Protected Attributes inherited from logic::Subject
std::list< std::weak_ptr< Observer > > observers

Constructor & Destructor Documentation

◆ WallModel()

WallModel::WallModel ( float normalizedX,
float normalizedY,
bool isDoor )
explicit

Constructs a WallModel instance.

Walls are static entities and outside of being used for collission detetcion don't really do anything.

Parameters
normalizedXNormalized x coordinate
normalizedYNormalized y coordinate
isDoorWhether this Wall may be considered a door under specific conditions.

Member Function Documentation

◆ isDoor()

bool logic::WallModel::isDoor ( ) const
inlinenodiscard

Returns whether this wall piece is a door. Doors are walls that can be passed through by ghosts under certain conditions.

Doors act like a wall for Pacman and generally aswell for Ghosts. I added them for the functionality of the Ghost box. Ghosts spawn in this box and must leave it before they can target Pacman. While Ghosts are in this "leaving" state they may consider walls that are doors as non-existant/regular passage ways. Once they are outside the Ghost box they will start chasing Pacman, meaning they no longer consider door wall pieces as passthrough. Pacman never considers them as passthrough.

Returns
Whether this wall is a door

The documentation for this class was generated from the following files: