danmaku/entity.cpp

35 lines
525 B
C++
Raw Normal View History

2021-01-09 11:41:58 +01:00
#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());
}