From fb096afbdf3d24f5b9f31626ddf8581033346f88 Mon Sep 17 00:00:00 2001 From: JAROWMR Date: Sat, 28 Dec 2024 19:33:06 +0100 Subject: coins with system pooling --- game/coins/CoinSystemScript.h | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'game/coins/CoinSystemScript.h') diff --git a/game/coins/CoinSystemScript.h b/game/coins/CoinSystemScript.h index 96744f1..6cf613a 100644 --- a/game/coins/CoinSystemScript.h +++ b/game/coins/CoinSystemScript.h @@ -1,13 +1,23 @@ #pragma once -#include "CoinSystem.h" +#include "CoinData.h" +#include "api/CircleCollider.h" #include "api/Script.h" +#include "api/Sprite.h" +#include "api/Transform.h" class CoinSystemScript : public crepe::Script { public: CoinSystemScript() {}; - // void init() override; + void init() override; void frame_update(crepe::duration_t dt) override; private: - CoinSystem coin_system; + void add_location(const crepe::vec2& location); + void despawn_coins(); + void spawn_coins(); +private: + static constexpr float SPAWN_DISTANCE = 400; + static constexpr float DESPAWN_DISTANCE = 400; + static constexpr float SPAWN_AREA = 50; + static std::vector coin_locations; }; -- cgit v1.2.3