summaryrefslogtreecommitdiff
path: root/src/physics.c
diff options
context:
space:
mode:
authorBoredGuy <osome3717@gmail.com>2025-09-10 18:49:20 +0300
committerBoredGuy <osome3717@gmail.com>2025-09-10 18:49:20 +0300
commitc2add3e23ee1b69f059d5b78e33c0a922dc1a22d (patch)
tree3781913b577f6c94172fcd864c1873df8fc87324 /src/physics.c
parent1418b5ade374a58bfdf2e3dfee8a4263d642442f (diff)
Hitbox-Hurtbox Collisions
Diffstat (limited to 'src/physics.c')
-rw-r--r--src/physics.c21
1 files changed, 19 insertions, 2 deletions
diff --git a/src/physics.c b/src/physics.c
index 6781c41..72d9410 100644
--- a/src/physics.c
+++ b/src/physics.c
@@ -1,6 +1,7 @@
#include "physics.h"
#include "game.h"
#include "utils.h"
+#include "constants.h"
extern Game game;
@@ -54,8 +55,24 @@ void DebugHighlights(const Entity* e) {
Rectangle dstRect = GetPhysicsColliderGlobal(e);
Color colliderDrawColor = e->physicsColliderColor;
- colliderDrawColor.a = 170;
+ colliderDrawColor.a = COLLIDER_ALPHA;
- DrawRectangle(dstRect.x, dstRect.y, dstRect.width, dstRect.height, colliderDrawColor);
+ DrawRectangleRec(dstRect, colliderDrawColor);
+
+ for (int i = 0; i < e->numHitBoxes; i++) {
+ Color hitboxDrawColor = e->hitboxColors[i];
+ hitboxDrawColor.a = COLLIDER_ALPHA;
+
+ Rectangle dstRect = GetEntityHitboxGlobal(e, i);
+ DrawRectangleRec(dstRect, hitboxDrawColor);
+ }
+
+ for (int i = 0; i < e->numHurtBoxes; i++) {
+ Color hurtboxDrawColor = e->hurtboxColors[i];
+ hurtboxDrawColor.a = COLLIDER_ALPHA;
+
+ Rectangle dstRect = GetEntityHurtboxGlobal(e, i);
+ DrawRectangleRec(dstRect, hurtboxDrawColor);
+ }
}
#endif