aboutsummaryrefslogtreecommitdiff
path: root/game/coins/CoinSystemScript.h
diff options
context:
space:
mode:
authorJAROWMR <jarorutjes07@gmail.com>2025-01-03 16:12:14 +0100
committerJAROWMR <jarorutjes07@gmail.com>2025-01-03 16:12:14 +0100
commitf18635b6c73f753bd38343684134430a5ce9b22c (patch)
treee838c01914244c517b17d6359241a8cbf78ac6ae /game/coins/CoinSystemScript.h
parentb82c302e2eb5044ae966230a50aae9bdb698cf8c (diff)
added coins random and menu banner update
Diffstat (limited to 'game/coins/CoinSystemScript.h')
-rw-r--r--game/coins/CoinSystemScript.h28
1 files changed, 21 insertions, 7 deletions
diff --git a/game/coins/CoinSystemScript.h b/game/coins/CoinSystemScript.h
index 8dcd793..51739d6 100644
--- a/game/coins/CoinSystemScript.h
+++ b/game/coins/CoinSystemScript.h
@@ -5,6 +5,7 @@
#include "api/Script.h"
#include "api/Sprite.h"
#include "api/Transform.h"
+#include <random>
class CoinSystemScript : public crepe::Script {
public:
@@ -15,12 +16,28 @@ private:
void add_location(const crepe::vec2& location);
void despawn_coins();
void spawn_coins();
+ void generate_locations();
float preset_1(const crepe::vec2 & begin_position);
float preset_2(const crepe::vec2 & begin_position);
float preset_3(const crepe::vec2 & begin_position);
float preset_4(const crepe::vec2 & begin_position);
float preset_5(const crepe::vec2 & begin_position);
private:
+ std::vector<std::function<float(const crepe::vec2&)>> functions = {
+ [this](const crepe::vec2& pos) { return preset_1(pos); },
+ [this](const crepe::vec2& pos) { return preset_2(pos); },
+ [this](const crepe::vec2& pos) { return preset_3(pos); },
+ [this](const crepe::vec2& pos) { return preset_4(pos); },
+ [this](const crepe::vec2& pos) { return preset_5(pos); }
+ };
+ std::vector<int> weights = {20, 20,20,20, 20};
+ std::random_device rd;
+ std::default_random_engine engine;
+ float system_position = 1200;
+ static constexpr float SYSTEM_POSITION_OFFSET = 200;
+private:
+ static constexpr float SPAWN_SPACING_MIN = 400;
+ static constexpr float SPAWN_SPACING_MAX = 1000;
static constexpr float SPAWN_DISTANCE = 400;
static constexpr float DESPAWN_DISTANCE = 400;
static constexpr float SPAWN_AREA = 50;
@@ -64,13 +81,10 @@ private:
static constexpr float COLUM_OFFSET_4 = 25;
static constexpr int COLUM_AMOUNT_4 = 3;
// preset five settings
-// ** **
-// ** **
-// **
-// **
-// ** **
-// ** **
+//
+// ***
+//
static constexpr float ROW_OFFSET_5 = 25;
static constexpr float COLUM_OFFSET_5 = 25;
- static constexpr int COLUM_AMOUNT_5 = 2;
+ static constexpr int COLUM_AMOUNT_5 = 3;
};