diff options
Diffstat (limited to 'game/prefab')
-rw-r--r-- | game/prefab/ZapperObject.cpp | 1 | ||||
-rw-r--r-- | game/prefab/ZapperPoolScript.cpp | 12 | ||||
-rw-r--r-- | game/prefab/ZapperPoolScript.h | 1 | ||||
-rw-r--r-- | game/prefab/ZapperPoolSubScene.cpp | 5 | ||||
-rw-r--r-- | game/prefab/ZapperPoolSubScene.h | 4 |
5 files changed, 10 insertions, 13 deletions
diff --git a/game/prefab/ZapperObject.cpp b/game/prefab/ZapperObject.cpp index 6139d53..24bbbd2 100644 --- a/game/prefab/ZapperObject.cpp +++ b/game/prefab/ZapperObject.cpp @@ -116,4 +116,3 @@ void ZapperObject::set_active(bool active) { this->active = active; } - diff --git a/game/prefab/ZapperPoolScript.cpp b/game/prefab/ZapperPoolScript.cpp index 168637c..b832ddd 100644 --- a/game/prefab/ZapperPoolScript.cpp +++ b/game/prefab/ZapperPoolScript.cpp @@ -23,23 +23,24 @@ void ZapperPoolScript::init() { } void ZapperPoolScript::fixed_update(crepe::duration_t) { - float threshold = camera_transform->position.x - camera_camera->viewport_size.x / 2 - OFFSCREEN_MARGIN; + float threshold + = camera_transform->position.x - camera_camera->viewport_size.x / 2 - OFFSCREEN_MARGIN; for (ZapperObject & zapper : this->pool) { if (!zapper.active) continue; - if (zapper.transform.position.x < threshold) - zapper.set_active(false); + if (zapper.transform.position.x < threshold) zapper.set_active(false); } } void ZapperPoolScript::spawn_random() { OptionalRef<ZapperObject> zapper = this->get_next_zapper(); if (!zapper) return; // pool exhausted - + bool horizontal = Random::b(); vec2 pos; float rotation, length; - pos.x = camera_transform->position.x + camera_camera->viewport_size.x / 2 + OFFSCREEN_MARGIN; + pos.x + = camera_transform->position.x + camera_camera->viewport_size.x / 2 + OFFSCREEN_MARGIN; if (horizontal) { rotation = 90; @@ -67,4 +68,3 @@ OptionalRef<ZapperObject> ZapperPoolScript::get_next_zapper() { } return {}; } - diff --git a/game/prefab/ZapperPoolScript.h b/game/prefab/ZapperPoolScript.h index dd60071..2208c80 100644 --- a/game/prefab/ZapperPoolScript.h +++ b/game/prefab/ZapperPoolScript.h @@ -31,4 +31,3 @@ private: static constexpr float MAX_LENGTH = 400; static constexpr float OFFSCREEN_MARGIN = 50 + MAX_LENGTH; }; - diff --git a/game/prefab/ZapperPoolSubScene.cpp b/game/prefab/ZapperPoolSubScene.cpp index e341090..8422b8c 100644 --- a/game/prefab/ZapperPoolSubScene.cpp +++ b/game/prefab/ZapperPoolSubScene.cpp @@ -1,13 +1,13 @@ #include <crepe/api/BehaviorScript.h> -#include "ZapperPoolSubScene.h" #include "ZapperPoolScript.h" +#include "ZapperPoolSubScene.h" using namespace crepe; using namespace std; ZapperPoolSubScene::ZapperPoolSubScene(Scene & scene) - : controller { scene.new_object("controller") } { + : controller {scene.new_object("controller")} { Log::logf(Log::DEBUG, "Building zapper pool..."); vector<ZapperObject> pool; @@ -16,4 +16,3 @@ ZapperPoolSubScene::ZapperPoolSubScene(Scene & scene) BehaviorScript & behavior = this->controller.add_component<BehaviorScript>(); behavior.set_script<ZapperPoolScript>(std::move(pool)); } - diff --git a/game/prefab/ZapperPoolSubScene.h b/game/prefab/ZapperPoolSubScene.h index f930e22..6f6e297 100644 --- a/game/prefab/ZapperPoolSubScene.h +++ b/game/prefab/ZapperPoolSubScene.h @@ -1,8 +1,8 @@ #pragma once -#include <crepe/api/Scene.h> -#include <crepe/api/GameObject.h> #include <crepe/api/Event.h> +#include <crepe/api/GameObject.h> +#include <crepe/api/Scene.h> #include <crepe/util/OptionalRef.h> class CreateZapperEvent : public crepe::Event {}; |