From 5f341eacdf0d75a4b334969a2d8a4701d61e4d9e Mon Sep 17 00:00:00 2001 From: quou Date: Sun, 7 May 2023 12:53:46 +1000 Subject: Add waves and stuff. --- wave.c | 45 ++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 42 insertions(+), 3 deletions(-) (limited to 'wave.c') diff --git a/wave.c b/wave.c index 93b43f4..e6f4e44 100644 --- a/wave.c +++ b/wave.c @@ -1,9 +1,23 @@ -#include "enemy.h" +#include "spawner.h" #include "standard.h" #include "wave.h" #include "world.h" static const Wave waves[] = { + { + { + { + 20, + 2, + { + { 3, 5 }, + { 15, 15 }, + } + } + }, + 1, + 2 + }, { { { @@ -14,8 +28,19 @@ static const Wave waves[] = { { 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; +} -- cgit v1.2.3-54-g00ecf