diff options
author | quou <quou@disroot.org> | 2023-05-07 12:53:46 +1000 |
---|---|---|
committer | quou <quou@disroot.org> | 2023-05-07 12:54:06 +1000 |
commit | 5f341eacdf0d75a4b334969a2d8a4701d61e4d9e (patch) | |
tree | ee3a4c44b92e975530e1e6fed18c8852a6f70a93 /wave.c | |
parent | 5ef6a71e935e2c3d1e5f9828e8cdbd78403a06a0 (diff) |
Add waves and stuff.
Diffstat (limited to 'wave.c')
-rw-r--r-- | wave.c | 45 |
1 files changed, 42 insertions, 3 deletions
@@ -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; +} |