35 lines
525 B
C++
35 lines
525 B
C++
#include "entity.h"
|
|
|
|
Entity::Entity() :
|
|
vector_velocity(0.f, 0.f)
|
|
{}
|
|
|
|
Entity::~Entity()
|
|
{}
|
|
|
|
void Entity::setVelocity(sf::Vector2f vel)
|
|
{
|
|
vector_velocity = vel;
|
|
}
|
|
|
|
void Entity::setVelocity(float vx, float vy)
|
|
{
|
|
vector_velocity.x = vx;
|
|
vector_velocity.y = vy;
|
|
}
|
|
|
|
const sf::Vector2f& Entity::velocity() const
|
|
{
|
|
return vector_velocity;
|
|
}
|
|
|
|
void Entity::accelerate(sf::Vector2f vel)
|
|
{
|
|
vector_velocity += vel;
|
|
}
|
|
|
|
void Entity::updateCurrent(const sf::Time& dt)
|
|
{
|
|
move(vector_velocity * dt.asSeconds());
|
|
}
|