2022-01-23 19:13:38 +01:00
|
|
|
#ifndef ENTITY_CPP
|
|
|
|
|
#define ENTITY_CPP
|
|
|
|
|
|
|
|
|
|
void Entity::SetVelocity(sf::Vector2f velocity)
|
|
|
|
|
{
|
|
|
|
|
mVelocity = velocity;
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-24 12:17:58 +01:00
|
|
|
void Entity::SetVelocity(float velocityX, float velocityY)
|
2022-01-23 19:13:38 +01:00
|
|
|
{
|
|
|
|
|
mVelocity.x = velocityX;
|
|
|
|
|
mVelocity.y = velocityY;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
sf::Vector2f Entity::getVelocity() const
|
|
|
|
|
{
|
|
|
|
|
return mVelocity;
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-24 09:40:04 +01:00
|
|
|
void Entity::updateCurrent(sf::Time deltaTime)
|
|
|
|
|
{
|
|
|
|
|
move(mVelocity * deltaTime.asSeconds()); // shortcut for setPosition(getPosition() + offset)
|
|
|
|
|
}
|
|
|
|
|
|
2022-01-23 19:13:38 +01:00
|
|
|
#endif
|