Skip to content

Commit

Permalink
Implement entity isMoving function
Browse files Browse the repository at this point in the history
  • Loading branch information
polldo committed Jul 14, 2021
1 parent c996f51 commit a33e56d
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/engine/PEntity.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,12 @@ Vect2 PEntity::getMovement()
return (Vect2(0, 0));
}

bool PEntity::isMoving()
{
Vect2 mov = getMovement();
return (mov.x != 0 || mov.y != 0);
}

void PEntity::update(UpdateCallback onUpdate)
{
if (_entity && _entity->_updateComponent) _entity->_updateComponent->config(onUpdate);
Expand Down
1 change: 1 addition & 0 deletions src/engine/PEntity.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ class PEntity {

void moveTo(int x, int y, int velocity);
Vect2 getMovement();
bool isMoving();

void update(UpdateCallback onUpdate);

Expand Down

0 comments on commit a33e56d

Please sign in to comment.