summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/barrel.h6
-rw-r--r--include/barrel_data.h15
-rw-r--r--include/game.h4
-rw-r--r--include/player_data.h6
-rw-r--r--include/utils.h2
5 files changed, 29 insertions, 4 deletions
diff --git a/include/barrel.h b/include/barrel.h
new file mode 100644
index 0000000..7cc3ea0
--- /dev/null
+++ b/include/barrel.h
@@ -0,0 +1,6 @@
+#pragma once
+
+#include "game.h"
+
+void AddBarrel(float xpos, float ypos);
+void UpdateBarrel(float dt);
diff --git a/include/barrel_data.h b/include/barrel_data.h
new file mode 100644
index 0000000..0db5fdd
--- /dev/null
+++ b/include/barrel_data.h
@@ -0,0 +1,15 @@
+#include "barrel.h"
+
+static const Rectangle physicsCollider = (Rectangle) {
+ .x = NO_OFFSET,
+ .y = NO_OFFSET,
+ .width = 100,
+ .height = 100
+};
+
+static const Rectangle destRect = (Rectangle) {
+ .x = -65,
+ .y = -140,
+ .width = 230,
+ .height = 300
+};
diff --git a/include/game.h b/include/game.h
index 99529bf..2c4ea24 100644
--- a/include/game.h
+++ b/include/game.h
@@ -13,7 +13,8 @@
typedef enum EntityType {
Player_Entity,
Wall_Entity,
- Background_Entity
+ Background_Entity,
+ Barrel_Entity
} EntityType;
typedef enum DrawLayer {
@@ -36,6 +37,7 @@ typedef struct Sprite {
Texture2D texture;
DrawLayer layer;
Rectangle destRect; //Destination rectangle relative to player position
+ Rectangle srcRect; //For un-animated sprites only
bool flipX;
bool flipY;
diff --git a/include/player_data.h b/include/player_data.h
index d9d45a1..bcd3bae 100644
--- a/include/player_data.h
+++ b/include/player_data.h
@@ -5,21 +5,21 @@
#define PLAYER_SPEED 300.0f
-const Rectangle shadowDestRect = (Rectangle) {
+static const Rectangle shadowDestRect = (Rectangle) {
.x = -30,
.y = 100,
.width = 140,
.height = 40
};
-const Rectangle physicsCollider = (Rectangle) {
+static const Rectangle physicsCollider = (Rectangle) {
.x = NO_OFFSET,
.y = NO_OFFSET,
.width = 100,
.height = 100
};
-const Rectangle bodyDestRect = (Rectangle) {
+static const Rectangle bodyDestRect = (Rectangle) {
.x = -160,
.y = -280,
.width = 400,
diff --git a/include/utils.h b/include/utils.h
index 3381828..5a4a4ac 100644
--- a/include/utils.h
+++ b/include/utils.h
@@ -4,6 +4,8 @@
#include <stdbool.h>
#include "game.h"
+#define UNUSED(x) (void)x
+
static inline bool EntityAllocated(const Entity* e) {
return (e->flags & ENTITY_ALLOCATED);
}