Update animation example

This commit is contained in:
SeanOMik 2020-07-12 22:42:10 -05:00
parent 65575702d9
commit 5427f85c0a
No known key found for this signature in database
GPG Key ID: FA4D55AC05268A88
1 changed files with 3 additions and 15 deletions

View File

@ -24,7 +24,7 @@ private:
sf::Vector2u window_size; sf::Vector2u window_size;
public: public:
explicit PlayerEntity(sf::Vector2u window_size) : window_size(window_size) { explicit PlayerEntity(sf::Vector2u window_size) : Entity(sprite), window_size(window_size) {
texture.loadFromFile("player_sheet.png"); texture.loadFromFile("player_sheet.png");
texture.setSmooth(true); texture.setSmooth(true);
sprite.setTexture(texture); sprite.setTexture(texture);
@ -39,8 +39,8 @@ public:
AddComponent(std::move(move_anim_component)); AddComponent(std::move(move_anim_component));
AddComponent(std::make_unique<simpleengine::HitboxComponent>(*this, sprite, AddComponent(std::make_unique<simpleengine::HitboxComponent>(*this, sprite,
0, 0, 20, 12,
sprite.getGlobalBounds().width, sprite.getGlobalBounds().height)); sprite.getGlobalBounds().width - 40, sprite.getGlobalBounds().height - 15));
} }
~PlayerEntity() override { ~PlayerEntity() override {
@ -49,18 +49,6 @@ public:
simpleengine::Entity::~Entity(); simpleengine::Entity::~Entity();
} }
void Move(const float& delta_time, const float& x, const float& y) override {
sprite.move(x, y);
}
void Move(const float& delta_time, const sf::Vector2f& offset) override {
sprite.move(offset * delta_time);
}
void Move(const sf::Vector2f& offset) override {
sprite.move(offset);
}
void Update(const float& delta_time) override { void Update(const float& delta_time) override {
Entity::Update(delta_time); Entity::Update(delta_time);
} }