diff --git a/modules/break_utopia/hit_box.cpp b/modules/break_utopia/hit_box.cpp index 30fc97be..a1ec7e81 100644 --- a/modules/break_utopia/hit_box.cpp +++ b/modules/break_utopia/hit_box.cpp @@ -8,8 +8,12 @@ void HitBox::_bind_methods() { } void HitBox::damage(int level) { + if (this->destroyed) { + return; + } if (level >= this->defense) { GDVIRTUAL_CALL(damaged, level); + this->destroyed = true; } else { GDVIRTUAL_CALL(damage_blocked, level); } diff --git a/modules/break_utopia/hit_box.h b/modules/break_utopia/hit_box.h index 592f2b57..ade7d33e 100644 --- a/modules/break_utopia/hit_box.h +++ b/modules/break_utopia/hit_box.h @@ -12,6 +12,7 @@ public: private: int defense{ 1 }; + bool destroyed{ false }; public: GET_SET_FNS(int, defense);