Add `HitboxComponent::GetHitbox`
This commit is contained in:
parent
05ae937acf
commit
65575702d9
|
@ -23,6 +23,8 @@ namespace simpleengine {
|
|||
HitboxComponent(Entity& owning_entity, sf::Sprite& sprite, float sprite_offset_x, float sprite_offset_y,
|
||||
float width, float height);
|
||||
|
||||
sf::RectangleShape& GetHitbox() const;
|
||||
|
||||
bool DoesIntersect(const sf::FloatRect& rect);
|
||||
|
||||
void Update(const float &delta_time) override;
|
||||
|
|
|
@ -8,8 +8,6 @@
|
|||
#include "components/ssma_component.h"
|
||||
#include "entity.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
simpleengine::HitboxComponent::HitboxComponent(Entity& owning_entity, sf::Sprite &sprite, float sprite_offset_x, float sprite_offset_y,
|
||||
float width, float height) : Component(owning_entity), sprite(sprite), offset_x(sprite_offset_x), offset_y(sprite_offset_y) {
|
||||
|
||||
|
@ -26,6 +24,10 @@ simpleengine::HitboxComponent::HitboxComponent(Entity& owning_entity, sf::Sprite
|
|||
}
|
||||
}
|
||||
|
||||
sf::RectangleShape &simpleengine::HitboxComponent::GetHitbox() const {
|
||||
return hitbox;
|
||||
}
|
||||
|
||||
bool simpleengine::HitboxComponent::DoesIntersect(const sf::FloatRect &rect) {
|
||||
return hitbox.getGlobalBounds().intersects(rect);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue