From 40eb179043b77f011fb1048c386ee187f64569d0 Mon Sep 17 00:00:00 2001 From: quou Date: Sun, 7 May 2023 09:37:45 +1000 Subject: Add waves and some more polish. --- wave.h | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 wave.h (limited to 'wave.h') diff --git a/wave.h b/wave.h new file mode 100644 index 0000000..3d40981 --- /dev/null +++ b/wave.h @@ -0,0 +1,36 @@ +#ifndef wave_h +#define wave_h + +#include "config.h" + +/* TODO: Different enemies. */ + +typedef struct Waver Waver; + +typedef void (*Wave_Finish)(Waver* waver, int last); + +typedef struct { + int x, y; +} Wave_Spawn; + +typedef struct { + int frame; + int count; + Wave_Spawn spawns[wave_max_spawns]; +} Subwave; + +typedef struct { + Subwave subwaves[wave_max_subwaves]; + int subwave_count; +} Wave; + +struct Waver { + int idx, sidx; + int timer; +}; + +void init_waver(Waver* waver); +void next_wave(Waver* waver); +void update_waver(Waver* waver, struct World* world); + +#endif -- cgit v1.2.3-54-g00ecf