aboutsummaryrefslogtreecommitdiff
path: root/game/prefab/ZapperPoolScript.h
diff options
context:
space:
mode:
authorheavydemon21 <nielsstunnebrink1@gmail.com>2025-01-08 14:39:16 +0100
committerheavydemon21 <nielsstunnebrink1@gmail.com>2025-01-08 14:39:16 +0100
commit18a8813645187102fc6261b8d5be1a41c8f0dae4 (patch)
tree655c5d22027fa23af3378df2d92d4051a71be2a6 /game/prefab/ZapperPoolScript.h
parent0729209117a4393e66d7f5b6d83083e2d7c0694c (diff)
parentd9c67da9b8c2d8d25ef4dd2c700ddc78573d3a60 (diff)
Merge remote-tracking branch 'origin/loek/game' into niels/game
Diffstat (limited to 'game/prefab/ZapperPoolScript.h')
-rw-r--r--game/prefab/ZapperPoolScript.h33
1 files changed, 33 insertions, 0 deletions
diff --git a/game/prefab/ZapperPoolScript.h b/game/prefab/ZapperPoolScript.h
new file mode 100644
index 0000000..6aee8b2
--- /dev/null
+++ b/game/prefab/ZapperPoolScript.h
@@ -0,0 +1,33 @@
+#pragma once
+
+#include <crepe/api/Script.h>
+
+#include "ZapperObject.h"
+#include "util/OptionalRef.h"
+
+class ZapperPoolSubScene;
+
+class ZapperPoolScript : public crepe::Script {
+public:
+ ZapperPoolScript(std::vector<ZapperObject> && pool);
+
+ void init();
+ void fixed_update(crepe::duration_t);
+
+ unsigned i = 0;
+
+private:
+ std::vector<ZapperObject> pool;
+
+private:
+ crepe::OptionalRef<crepe::Transform> camera_transform;
+ crepe::OptionalRef<crepe::Camera> camera_camera;
+ crepe::OptionalRef<ZapperObject> get_next_zapper();
+
+private:
+ void spawn_random();
+
+private:
+ static constexpr float OFFSCREEN_MARGIN = 40;
+};
+