summaryrefslogtreecommitdiff
path: root/include
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 /include
parent1418b5ade374a58bfdf2e3dfee8a4263d642442f (diff)
Hitbox-Hurtbox Collisions
Diffstat (limited to 'include')
-rw-r--r--include/barrel.h1
-rw-r--r--include/constants.h2
-rw-r--r--include/game.h20
-rw-r--r--include/player_data.h16
4 files changed, 27 insertions, 12 deletions
diff --git a/include/barrel.h b/include/barrel.h
index 7cc3ea0..d905004 100644
--- a/include/barrel.h
+++ b/include/barrel.h
@@ -4,3 +4,4 @@
void AddBarrel(float xpos, float ypos);
void UpdateBarrel(float dt);
+void BarrelHandleCollision(Entity* barrel);
diff --git a/include/constants.h b/include/constants.h
index a2ea961..366da35 100644
--- a/include/constants.h
+++ b/include/constants.h
@@ -15,3 +15,5 @@
#define FPS_POS_X 10
#define FPS_POS_Y 10
+
+#define COLLIDER_ALPHA 170
diff --git a/include/game.h b/include/game.h
index b9df2ce..d79c790 100644
--- a/include/game.h
+++ b/include/game.h
@@ -65,10 +65,12 @@ typedef struct Entity {
Sprite sprites[MAX_SPRITE_COUNT];
int numSprites;
- #ifdef BEATEMUP_DEBUG
- //Debug information
- Color physicsColliderColor;
- #endif
+#ifdef BEATEMUP_DEBUG
+ //Debug information
+ Color physicsColliderColor;
+ Color hitboxColors[MAX_AREA_COUNT];
+ Color hurtboxColors[MAX_AREA_COUNT];
+#endif
//Human entity information
int bodySpriteIndex;
@@ -80,10 +82,10 @@ typedef struct Game {
Entity entities[MAX_ENTITY_COUNT];
Camera2D camera;
- #ifdef BEATEMUP_DEBUG
- //Debug information
- bool enableDebugOverlay;
- #endif
+#ifdef BEATEMUP_DEBUG
+ //Debug information
+ bool enableDebugOverlay;
+#endif
} Game;
//Entity Stuff
@@ -104,7 +106,7 @@ Rectangle GetSrcRectFromIndex
int framesX,
int framesY,
int index
-);
+ );
typedef struct {
Texture texture;
diff --git a/include/player_data.h b/include/player_data.h
index f8e937a..7df3c77 100644
--- a/include/player_data.h
+++ b/include/player_data.h
@@ -5,27 +5,37 @@
#define PLAYER_SPEED 300.0f
-static const Rectangle shadowDestRect = (Rectangle) {
+Rectangle shadowDestRect = (Rectangle) {
.x = -20,
.y = 115,
.width = 128,
.height = 20
};
-static const Rectangle physicsCollider = (Rectangle) {
+Rectangle physicsCollider = (Rectangle) {
.x = NO_OFFSET,
.y = NO_OFFSET,
.width = 100,
.height = 100
};
-static const Rectangle bodyDestRect = (Rectangle) {
+Rectangle bodyDestRect = (Rectangle) {
.x = -160,
.y = -280,
.width = 400,
.height = 400
};
+#define HITBOX_XPOS 70
+#define HITBOX_XPOS_FLIPPED -90
+
+Rectangle punchHitBox = (Rectangle) {
+ .x = HITBOX_XPOS,
+ .y = -5,
+ .width = 100,
+ .height = 40
+};
+
#define IDLE_FTIME 0.1f
#endif // PLAYER_DATA_H_