19 explicit EntityModel(
float normalizedX,
float normalizedY);
26 [[nodiscard]]
float getX()
const;
31 [[nodiscard]]
float getY()
const;
96 virtual void move(
const World &world,
float dt) = 0;
virtual Events collect()=0
Function that will be called when Pacman interacts with a collectible entity. Must handle this intera...
CollectibleEntityModel(float normalizedX, float normalizedY)
Subclass of EntityModel to be used by collectible entities.
Definition EntityModel.cpp:19
float x
Definition EntityModel.h:34
~EntityModel() override=default
EntityModel(float normalizedX, float normalizedY)
Base class for entities.
Definition EntityModel.cpp:7
float y
Definition EntityModel.h:35
float getY() const
Definition EntityModel.cpp:14
float getX() const
Definition EntityModel.cpp:10
float targetX
Definition EntityModel.h:128
int gridX
Definition EntityModel.h:127
float mapWidth
Definition EntityModel.h:120
int gridY
Definition EntityModel.h:126
MovingEntityModel(float normalizedX, float normalizedY, float mapWidth, float mapHeight, float speed)
Subclass of EntityModel to be used for any moving entity.
Definition EntityModel.cpp:22
void normalizeTarget()
Normalizes the grid coordinates and stores these values in as target coordinates. Moving entities str...
Definition EntityModel.cpp:44
int getGridY() const
Definition EntityModel.cpp:39
virtual void move(const World &world, float dt)=0
Called within the World update loop and should update the position of the entity or handle moving the...
float spawnX
Definition EntityModel.h:123
float targetY
Definition EntityModel.h:129
Moves direction
Definition EntityModel.h:131
virtual void respawn()=0
Called when an entity should respawn, this means it died and should be 'reset' to some extent.
int getGridX() const
Definition EntityModel.cpp:35
float speed
Definition EntityModel.h:132
Moves getDirection() const
Get the direction the entity is currently moving in.
Definition EntityModel.cpp:31
virtual bool gridTargetReached(const World &world)=0
This function should be called when the MovingEntity has reached its targetX and targetY values (with...
float spawnY
Definition EntityModel.h:124
float mapHeight
Definition EntityModel.h:121
Definition Difficulty.h:6
constexpr float TARGET_EPSILON
Definition EntityModel.h:58
Moves
Definition EntityModel.h:8
@ DOWN
Definition EntityModel.h:8
@ LEFT
Definition EntityModel.h:8
@ RIGHT
Definition EntityModel.h:8
@ UP
Definition EntityModel.h:8
Events
Definition Observer.h:14