aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2024-10-01 20:38:27 +1000
committerquou <quou@disroot.org>2024-10-01 20:38:27 +1000
commitf06c36339c3c4d1c3287f710c6963c643bc5219d (patch)
tree58fc338c065ddf212e9245b8b6241e688f103f1e
parent25223a71460075b9b4f1cf8df82d89dafde24423 (diff)
World frame timer
-rw-r--r--world.c2
-rw-r--r--world.h1
2 files changed, 3 insertions, 0 deletions
diff --git a/world.c b/world.c
index 2b6187e..98950f1 100644
--- a/world.c
+++ b/world.c
@@ -5,6 +5,7 @@ void init_world(World* w) {
w->particle_count = 0;
w->enemy_count = 0;
w->deathzone_count = 0;
+ w->frame = 0;
init_player(&w->player);
}
@@ -63,6 +64,7 @@ void update_world(World* w, const App* a) {
for (i = w->enemy_count - 1; i >= 0; i--)
if (update_enemy(&w->enemies[i], w))
w->enemies[i] = w->enemies[--w->enemy_count];
+ w->frame++;
}
void ren_world(const World* w, struct Renderer* r) {
diff --git a/world.h b/world.h
index 14e2447..f8f5768 100644
--- a/world.h
+++ b/world.h
@@ -18,6 +18,7 @@ typedef struct World {
int deathzone_count;
Player player;
Map map;
+ int frame;
} World;
void init_world(World* w);