summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/barrel.h2
-rw-r--r--include/barrel_data.h20
-rw-r--r--include/constants.h2
-rw-r--r--include/game.h6
-rw-r--r--include/physics.h1
5 files changed, 27 insertions, 4 deletions
diff --git a/include/barrel.h b/include/barrel.h
index d905004..04f179d 100644
--- a/include/barrel.h
+++ b/include/barrel.h
@@ -3,5 +3,5 @@
#include "game.h"
void AddBarrel(float xpos, float ypos);
-void UpdateBarrel(float dt);
+void UpdateBarrel(Entity* barrel, float dt);
void BarrelHandleCollision(Entity* barrel);
diff --git a/include/barrel_data.h b/include/barrel_data.h
index 97a13db..8dbfd5e 100644
--- a/include/barrel_data.h
+++ b/include/barrel_data.h
@@ -1,15 +1,31 @@
#include "barrel.h"
-static const Rectangle physicsCollider = (Rectangle) {
+static Rectangle physicsCollider = (Rectangle) {
.x = NO_OFFSET,
.y = NO_OFFSET,
.width = 100,
.height = 120
};
-static const Rectangle destRect = (Rectangle) {
+static Rectangle destRect = (Rectangle) {
.x = -65,
.y = -140,
.width = 230,
.height = 300
};
+
+static Rectangle srcRect = (Rectangle) {
+ .x = 0,
+ .y = 0,
+ .width = 32,
+ .height = 32
+};
+
+static Rectangle srcRectDamaged = (Rectangle) {
+ .x = 32,
+ .y = 0,
+ .width = 32,
+ .height = 32
+};
+
+#define BARREL_REMOVE_TIME 1.0f
diff --git a/include/constants.h b/include/constants.h
index 366da35..7e4a6fe 100644
--- a/include/constants.h
+++ b/include/constants.h
@@ -17,3 +17,5 @@
#define FPS_POS_Y 10
#define COLLIDER_ALPHA 170
+
+#define GRAVITY 700.0f
diff --git a/include/game.h b/include/game.h
index d79c790..558f96f 100644
--- a/include/game.h
+++ b/include/game.h
@@ -38,6 +38,7 @@ typedef struct Sprite {
DrawLayer layer;
Rectangle destRect; //Destination rectangle relative to player position
Rectangle srcRect; //For un-animated sprites only
+ float alpha;
bool flipX;
bool flipY;
@@ -51,6 +52,7 @@ typedef struct Entity {
int id;
EntityType type;
uint16_t flags;
+ int state;
Vector2 position;
Vector2 velocity;
@@ -74,7 +76,9 @@ typedef struct Entity {
//Human entity information
int bodySpriteIndex;
- int state;
+
+ //Barrel entity information
+ float timeSinceLastHit;
} Entity;
typedef struct Game {
diff --git a/include/physics.h b/include/physics.h
index 5079293..29852fb 100644
--- a/include/physics.h
+++ b/include/physics.h
@@ -3,3 +3,4 @@
#include "game.h"
void MoveAndStop(Entity* e, float dt);
+void MoveWithoutPhysics(Entity* e, float dt);