Peoplemon  0.1.0
Peoplemon 3 game source documentation
Public Member Functions | Friends | List of all members
core::component::Movable Class Reference

Adding this component to an entity will allow it to move. More...

#include <Movable.hpp>

Public Member Functions

 Movable (bl::tmap::Position &pos, float speed, float fastSpeed)
 Construct a new Movable component. More...
 
bool moving () const
 Returns whether or not the entity is moving. More...
 
bool goingFast () const
 Returns whether or not the entity is going fast. More...
 
void move (bl::tmap::Direction dir, bool fast, bool isLedgeHop)
 Starts the entity moving in the given direction. Only updates the interpolated position, not the tile position. This does not check collisions. Use the Movement system to ensure the move is valid. More...
 
void update (bl::ecs::Entity owner, system::Systems &systems, float dt)
 Updates the interpolation of the entity if moving. More...
 

Friends

class system::Movement
 

Detailed Description

Adding this component to an entity will allow it to move.

Definition at line 26 of file Movable.hpp.

Constructor & Destructor Documentation

◆ Movable()

core::component::Movable::Movable ( bl::tmap::Position &  pos,
float  speed,
float  fastSpeed 
)

Construct a new Movable component.

Parameters
posA handle to the position component of the owning entity
speedThe speed to move at
fastSpeedThe speed to move at when moving fast

Definition at line 37 of file Movable.cpp.

Member Function Documentation

◆ goingFast()

bool core::component::Movable::goingFast ( ) const

Returns whether or not the entity is going fast.

Definition at line 45 of file Movable.cpp.

◆ move()

void core::component::Movable::move ( bl::tmap::Direction  dir,
bool  fast,
bool  isLedgeHop 
)

Starts the entity moving in the given direction. Only updates the interpolated position, not the tile position. This does not check collisions. Use the Movement system to ensure the move is valid.

Parameters
dirThe direction to move in
fastTrue to move fast, false to move slow
isLedgeHopIndicates whether we are hopping or moving regularly

Definition at line 47 of file Movable.cpp.

◆ moving()

bool core::component::Movable::moving ( ) const

Returns whether or not the entity is moving.

Definition at line 43 of file Movable.cpp.

◆ update()

void core::component::Movable::update ( bl::ecs::Entity  owner,
system::Systems systems,
float  dt 
)

Updates the interpolation of the entity if moving.

Parameters
ownerThe owning entity of this component
systemsThe game systems
dtTime elapsed in seconds since last call to update

Definition at line 53 of file Movable.cpp.

Friends And Related Function Documentation

◆ system::Movement

friend class system::Movement
friend

Definition at line 79 of file Movable.hpp.


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