aboutsummaryrefslogtreecommitdiff
path: root/game/prefab
diff options
context:
space:
mode:
Diffstat (limited to 'game/prefab')
-rw-r--r--game/prefab/ZapperPoolScript.cpp8
-rw-r--r--game/prefab/ZapperPoolScript.h3
2 files changed, 10 insertions, 1 deletions
diff --git a/game/prefab/ZapperPoolScript.cpp b/game/prefab/ZapperPoolScript.cpp
index 00dd213..e42adc9 100644
--- a/game/prefab/ZapperPoolScript.cpp
+++ b/game/prefab/ZapperPoolScript.cpp
@@ -17,9 +17,15 @@ void ZapperPoolScript::init() {
});
}
+void ZapperPoolScript::fixed_update(crepe::duration_t) {
+ if (i++ < 80) return;
+ i = 0;
+ queue_event<CreateZapperEvent>();
+}
+
void ZapperPoolScript::spawn_random() {
vec2 pos = this->get_camera_pos();
- logf(Log::DEBUG, "Spawning random zappers at {}", pos);
+ logf(Log::DEBUG, "Spawning random zapper at {}", pos);
}
diff --git a/game/prefab/ZapperPoolScript.h b/game/prefab/ZapperPoolScript.h
index b545fbb..7c4701c 100644
--- a/game/prefab/ZapperPoolScript.h
+++ b/game/prefab/ZapperPoolScript.h
@@ -9,6 +9,9 @@ public:
ZapperPoolScript(ZapperPoolSubScene & pool);
void init();
+ void fixed_update(crepe::duration_t);
+
+ unsigned i = 0;
private:
ZapperPoolSubScene & pool;