Commit 012641ed authored by Kevin Balz's avatar Kevin Balz
Browse files

Merge branch 'feature/31-adjust-killable-hitboxes' into 'develop'

Resolve "Adjust Killable hitboxes"

Closes #31

See merge request !18
parents 7e4fec16 5c20900f
Pipeline #3327 passed with stage
in 2 minutes and 47 seconds
......@@ -18,6 +18,7 @@
"off_beat_threshold": 0.0
},
"Killable": {
"radius": 0.7
},
"FixedPath": {
}
......
......@@ -20,5 +20,6 @@
"FollowTarget": {
},
"Killable": {
"radius": 0.7
}
}
......@@ -20,7 +20,7 @@
"Input_controller": {},
"Player": {},
"Dash": {
"attack_width": 0.8
"attack_width": 2
},
"Stationary_attack": {
"radius": 3
......
......@@ -91,8 +91,11 @@ namespace phase_shifter::gameplay {
for(auto&& [entity, k_transform, kill] :
_ecs.list<Entity_handle, Transform_comp, Killable_comp>()) {
if (kill.only_stationary) {
continue;
}
auto circle = rotate_point({k_transform.position.x, k_transform.position.z}, angle);
if(rect_circle_intersects(topleft.x, topleft.y, width, height, circle.x, circle.y, 1)) {
if(rect_circle_intersects(topleft.x, topleft.y, width, height, circle.x, circle.y, kill.radius)) {
// calc attack angle
auto target_dir = glm::vec2(k_transform.position.x, k_transform.position.z)
- dash.last_position;
......
#include "killable_comp.hpp"
\ No newline at end of file
......@@ -6,10 +6,13 @@
namespace phase_shifter::gameplay {
struct Killable_comp : public mirrage::ecs::Stateless_tag_component<Killable_comp> {
struct Killable_comp : public mirrage::ecs::Component<Killable_comp> {
static constexpr const char* name() { return "Killable"; }
using Stateless_tag_component::Stateless_tag_component;
using Component::Component;
float radius = 1;
bool only_stationary = false;
};
sf2_structDef(Killable_comp, radius, only_stationary);
} // namespace phase_shifter::gameplay
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment