aboutsummaryrefslogtreecommitdiff
path: root/wave.c
diff options
context:
space:
mode:
authorquou <quou@disroot.org>2023-05-07 12:53:46 +1000
committerquou <quou@disroot.org>2023-05-07 12:54:06 +1000
commit5f341eacdf0d75a4b334969a2d8a4701d61e4d9e (patch)
treeee3a4c44b92e975530e1e6fed18c8852a6f70a93 /wave.c
parent5ef6a71e935e2c3d1e5f9828e8cdbd78403a06a0 (diff)
Add waves and stuff.
Diffstat (limited to 'wave.c')
-rw-r--r--wave.c45
1 files changed, 42 insertions, 3 deletions
diff --git a/wave.c b/wave.c
index 93b43f4..e6f4e44 100644
--- a/wave.c
+++ b/wave.c
@@ -1,4 +1,4 @@
-#include "enemy.h"
+#include "spawner.h"
#include "standard.h"
#include "wave.h"
#include "world.h"
@@ -13,9 +13,34 @@ static const Wave waves[] = {
{ 3, 5 },
{ 15, 15 },
}
+ }
+ },
+ 1,
+ 2
+ },
+ {
+ {
+ {
+ 20,
+ 2,
+ {
+ { 3, 5 },
+ { 15, 15 },
+ }
+ },
+ {
+ 200,
+ 4,
+ {
+ { 30, 30 },
+ { 15, 20 },
+ { 23, 5 },
+ { 6, 4 },
+ }
},
},
- 1
+ 2,
+ 6
}
};
@@ -25,8 +50,18 @@ void init_waver(Waver* waver) {
waver->timer = 0;
}
+void start_wave(struct World* world) {
+ world->wave_started = 1;
+ world->enemies_killed = 0;
+}
+
+int wave_enemy_count(const Waver* waver) {
+ return waves[waver->idx].kill_requirement;
+}
+
void next_wave(Waver* waver) {
waver->idx++;
+ waver->sidx = 0;
}
void update_waver(Waver* waver, World* world) {
@@ -45,7 +80,7 @@ void update_waver(Waver* waver, World* world) {
if (waver->timer >= subwave->frame) {
for (i = 0; i < subwave->count; i++) {
spawn = &subwave->spawns[i];
- new_skull(
+ new_spawner(
world,
(spawn->x * map_tile_size) << fbits,
(spawn->y * map_tile_size) << fbits
@@ -54,3 +89,7 @@ void update_waver(Waver* waver, World* world) {
waver->sidx++;
}
}
+
+int get_wave_count() {
+ return sizeof waves / sizeof *waves;
+}