diff options
author | BoredGuy <osome3717@gmail.com> | 2025-08-31 19:24:24 +0300 |
---|---|---|
committer | BoredGuy <osome3717@gmail.com> | 2025-08-31 19:24:24 +0300 |
commit | 1562dd67d16d328e919db28cfd48206c8c868fe4 (patch) | |
tree | fe8f78e9d94ae55ff3868739dc359dd4629f8441 /include/utils.h | |
parent | 8a7c25827624348ccd7a9ac8bf978e71117f8b75 (diff) |
Added hitbox/hurtbox system
- Made the entity struct much smaller
Diffstat (limited to 'include/utils.h')
-rw-r--r-- | include/utils.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/utils.h b/include/utils.h index 5a4a4ac..cb1770e 100644 --- a/include/utils.h +++ b/include/utils.h @@ -60,4 +60,21 @@ static inline Rectangle GetCurrentSourceRectangle(const Animation* animation) { return animation->srcRects[animation->currentFrame]; } +static inline Rectangle GetEntityHitboxGlobal(const Entity* e, int hbIndex) { + Rectangle hitBoxGlobal = e->hitBoxes[hbIndex]; + hitBoxGlobal.x += e->position.x; + hitBoxGlobal.y += e->position.y; + + return hitBoxGlobal; +} + +static inline Rectangle GetEntityHurtboxGlobal(const Entity* e, int hbIndex) { + Rectangle hurtBoxGlobal = e->hurtBoxes[hbIndex]; + hurtBoxGlobal.x += e->position.x; + hurtBoxGlobal.y += e->position.y; + + return hurtBoxGlobal; +} + + #endif // UTILS_H_ |