From f8ff90516422edacd11cf880eb703def321694c2 Mon Sep 17 00:00:00 2001
From: JAROWMR <jarorutjes07@gmail.com>
Date: Wed, 8 Jan 2025 20:38:42 +0100
Subject: endgame show score

---
 game/menus/endgame/EndGameSubScene.cpp  | 42 +++++++++++++++++++++++++++++++++
 game/menus/endgame/EndGameSubScript.cpp | 40 +++++++++++++++++++++++++++++++
 game/menus/endgame/EndGameSubScript.h   |  3 +++
 3 files changed, 85 insertions(+)

(limited to 'game/menus/endgame')

diff --git a/game/menus/endgame/EndGameSubScene.cpp b/game/menus/endgame/EndGameSubScene.cpp
index a6f8b25..0b72bdc 100644
--- a/game/menus/endgame/EndGameSubScene.cpp
+++ b/game/menus/endgame/EndGameSubScene.cpp
@@ -47,6 +47,48 @@ void EndGameSubScene::create(Scene & scn) {
 		vec2 {0, -207} + FONTOFFSET, TITEL_STRING
 	);
 
+	const float Y_SPACING = 50;
+	const float Y_OFFSET = -100;
+
+	// Gold gathered
+	const string GOLD_STRING = "gold:0";
+	GameObject gold = scn.new_object("gold_endgame", TAG);
+	crepe::vec2 size_gold = {200, (200.0f / GOLD_STRING.size()) * 2};
+	gold.add_component<Text>(
+		size_gold, FONT,
+		Text::Data {
+			.world_space = false,
+			.text_color = Color::GOLD,
+		},
+		vec2 {0, Y_OFFSET} + FONTOFFSET, GOLD_STRING
+	);
+
+	// Distance
+	const string DISTANCE_STRING = "0M";
+	GameObject distance = scn.new_object("distance_endgame", TAG);
+	crepe::vec2 size_distance = {200, (200.0f / DISTANCE_STRING.size()) * 2};
+	distance.add_component<Text>(
+		size_distance, FONT,
+		Text::Data {
+			.world_space = false,
+			.text_color = Color::WHITE,
+		},
+		vec2 {0, Y_SPACING+Y_OFFSET} + FONTOFFSET, DISTANCE_STRING
+	);
+
+	// Highscore
+	const string HIGHSCORE_STRING = "NEW HIGHSCORE";
+	GameObject highscore = scn.new_object("highscore_endgame", "highscore_tag_end");
+	crepe::vec2 size_highscore = {200, (200.0f / HIGHSCORE_STRING.size()) * 2};
+	highscore.add_component<Text>(
+		size_highscore, FONT,
+		Text::Data {
+			.world_space = false,
+			.text_color = Color::WHITE,
+		},
+		vec2 {0, Y_SPACING*2+Y_OFFSET} + FONTOFFSET, HIGHSCORE_STRING
+	).active = false;
+
 	// Buttons
 	vec2 button_position = {190, 190};
 	ButtonSubScene button;
diff --git a/game/menus/endgame/EndGameSubScript.cpp b/game/menus/endgame/EndGameSubScript.cpp
index 6edfe7b..e081350 100644
--- a/game/menus/endgame/EndGameSubScript.cpp
+++ b/game/menus/endgame/EndGameSubScript.cpp
@@ -3,6 +3,9 @@
 #include "../../Events.h"
 #include "../ButtonReplaySubScript.h"
 #include "../IFloatingWindowScript.h"
+#include "../../Config.h"
+#include "ValueBroker.h"
+#include "manager/SaveManager.h"
 
 #include <string>
 
@@ -21,6 +24,9 @@ void EndGameSubScript::init() {
 	this->subscribe<EndGameEvent>([this](const EndGameEvent e) {
 		return this->reset_timescale();
 	});
+	this->subscribe<ShowScoreEvent>([this](const ShowScoreEvent e) {
+		return this->showscore();
+	});
 }
 
 bool EndGameSubScript::disable_all() {
@@ -53,3 +59,37 @@ bool EndGameSubScript::reset_timescale() {
 	this->get_loop_timer().set_time_scale(1);
 	return false;
 }
+
+bool EndGameSubScript::showscore(){
+	// Gather text 
+	Text & coins_text = this->get_components_by_name<Text>("gold_endgame").front().get();
+	Text & distance_text = this->get_components_by_name<Text>("distance_endgame").front().get();
+	Text & highscore_text = this->get_components_by_name<Text>("highscore_endgame").front().get();
+	highscore_text.active = false;
+
+	// Gather saved data
+	SaveManager & savemgr = this->get_save_manager();
+	ValueBroker<std::string> coins = savemgr.get<std::string>(TOTAL_COINS_RUN, "0");
+	ValueBroker<std::string> distance = savemgr.get<std::string>(DISTANCE_RUN, "0");
+	int distance_run = savemgr.get<int>(DISTANCE_RUN, 0).get();
+	int distance_game = savemgr.get<int>(DISTANCE_GAME, 0).get();
+
+	// Show highscore
+	if(distance_run > distance_game) highscore_text.active = true;
+
+	const float CHAR_SIZE_DIS = 20;
+	// Show distance
+	std::string distance_string = "DISTANCE:" + distance.get(); 
+	distance_text.text = distance_string;
+	crepe::vec2 size_distance = {CHAR_SIZE_DIS*distance_string.size(), (CHAR_SIZE_DIS*distance_string.size() / distance_string.size()) * 2};
+	distance_text.dimensions = size_distance;
+
+	const float CHAR_SIZE_COIN = 16;
+	// Show coins
+	std::string coins_string = "Coins:" + coins.get(); 
+	coins_text.text = coins_string;
+	crepe::vec2 size_coins = {CHAR_SIZE_COIN*coins_string.size(), (CHAR_SIZE_COIN*coins_string.size() / coins_string.size()) * 2};
+	coins_text.dimensions = size_coins;
+
+	return false;
+}
diff --git a/game/menus/endgame/EndGameSubScript.h b/game/menus/endgame/EndGameSubScript.h
index 62a2f0c..c25f6ca 100644
--- a/game/menus/endgame/EndGameSubScript.h
+++ b/game/menus/endgame/EndGameSubScript.h
@@ -5,6 +5,8 @@
 #include <crepe/api/Event.h>
 #include <crepe/api/Script.h>
 
+struct ShowScoreEvent : public crepe::Event {};
+
 class EndGameSubScript : public IFloatingWindowScript {
 public:
 	EndGameSubScript(const std::string & tag);
@@ -12,4 +14,5 @@ public:
 	bool disable_all();
 	bool enable_all();
 	bool reset_timescale();
+	bool showscore();
 };
-- 
cgit v1.2.3


From d1cebcca2018ed4ef47ad125e45aafd018a2ab2e Mon Sep 17 00:00:00 2001
From: heavydemon21 <nielsstunnebrink1@gmail.com>
Date: Fri, 10 Jan 2025 14:43:42 +0100
Subject: make format

---
 game/PreviewScene.cpp                           |  9 ++-
 game/QuitScript.cpp                             |  9 +--
 game/QuitScript.h                               |  1 -
 game/menus/ButtonNextMainMenuSubScript.cpp      |  2 +-
 game/menus/ButtonReplaySubScript.cpp            |  8 +--
 game/menus/ButtonSubScene.cpp                   | 15 +++--
 game/menus/endgame/EndGameSubScene.cpp          | 21 ++++---
 game/menus/endgame/EndGameSubScript.cpp         | 26 +++++----
 game/menus/shop/ButtonBuySelectBubbleScript.cpp | 18 +++---
 game/menus/shop/ButtonBuySelectBulletScript.cpp | 18 +++---
 game/menus/shop/ShopLoadScript.cpp              | 73 ++++++++++++-------------
 game/menus/shop/ShopMenuScene.cpp               | 21 ++++---
 game/menus/shop/Shopconfig.h                    |  2 -
 game/missile/AlertSubScene.cpp                  |  4 +-
 game/missile/MissileScript.cpp                  | 12 ++--
 game/missile/MissileSubScene.cpp                | 15 +++--
 game/missile/SpawnEvent.cpp                     |  4 +-
 game/preview/PreviewReplaySubScript.cpp         | 19 +++----
 game/preview/PreviewReplaySubScript.h           |  1 +
 game/preview/PreviewStartRecSubScript.cpp       |  1 -
 game/preview/PreviewStopRecSubScript.cpp        |  1 -
 21 files changed, 135 insertions(+), 145 deletions(-)

(limited to 'game/menus/endgame')

diff --git a/game/PreviewScene.cpp b/game/PreviewScene.cpp
index 6871961..d9801a7 100644
--- a/game/PreviewScene.cpp
+++ b/game/PreviewScene.cpp
@@ -92,7 +92,6 @@ void PreviewScene::load_scene() {
 	HudSubScene hud;
 	hud.create(*this);
 
-
 	const float Y_POS_BUTTONS = -220;
 	const float X_POS_BUTTONS = -150;
 	const float X_POS_BUTTONS_SPACING = 145;
@@ -102,7 +101,7 @@ void PreviewScene::load_scene() {
 		ButtonSubScene::Data {
 			.text = "BACK",
 			.text_width = 60,
-			.position = {X_POS_BUTTONS,Y_POS_BUTTONS},
+			.position = {X_POS_BUTTONS, Y_POS_BUTTONS},
 			.script_type = ButtonSubScene::ScriptSelect::NEXT,
 			.button_type = ButtonSubScene::ButtonSelect::BACK,
 			.scale = 0.6,
@@ -117,7 +116,7 @@ void PreviewScene::load_scene() {
 		ButtonSubScene::Data {
 			.text = "START REC",
 			.text_width = 130,
-			.position = {X_POS_BUTTONS+X_POS_BUTTONS_SPACING,Y_POS_BUTTONS},
+			.position = {X_POS_BUTTONS + X_POS_BUTTONS_SPACING, Y_POS_BUTTONS},
 			.script_type = ButtonSubScene::ScriptSelect::PREVIEW_START,
 			.button_type = ButtonSubScene::ButtonSelect::LARGE,
 			.scale = 0.6,
@@ -133,7 +132,7 @@ void PreviewScene::load_scene() {
 		ButtonSubScene::Data {
 			.text = "STOP REC",
 			.text_width = 120,
-			.position = {X_POS_BUTTONS+X_POS_BUTTONS_SPACING*2,Y_POS_BUTTONS},
+			.position = {X_POS_BUTTONS + X_POS_BUTTONS_SPACING * 2, Y_POS_BUTTONS},
 			.script_type = ButtonSubScene::ScriptSelect::PREVIEW_STOP,
 			.button_type = ButtonSubScene::ButtonSelect::LARGE,
 			.scale = 0.6,
@@ -149,7 +148,7 @@ void PreviewScene::load_scene() {
 		ButtonSubScene::Data {
 			.text = "REPLAY",
 			.text_width = 90,
-			.position = {X_POS_BUTTONS+X_POS_BUTTONS_SPACING*3,Y_POS_BUTTONS},
+			.position = {X_POS_BUTTONS + X_POS_BUTTONS_SPACING * 3, Y_POS_BUTTONS},
 			.script_type = ButtonSubScene::ScriptSelect::PREVIEW_REPLAY,
 			.button_type = ButtonSubScene::ButtonSelect::LARGE,
 			.scale = 0.6,
diff --git a/game/QuitScript.cpp b/game/QuitScript.cpp
index fc33dcf..0c9f55a 100644
--- a/game/QuitScript.cpp
+++ b/game/QuitScript.cpp
@@ -5,19 +5,16 @@
 #include <crepe/api/Event.h>
 #include <crepe/api/KeyCodes.h>
 
-
 using namespace crepe;
 
-bool QuitScript::on_event(const KeyPressEvent & ev){
+bool QuitScript::on_event(const KeyPressEvent & ev) {
 	if (Keycode::ESCAPE == ev.key) {
-		trigger_event<ShutDownEvent>(ShutDownEvent{});
+		trigger_event<ShutDownEvent>(ShutDownEvent {});
 	}
 	return false;
 }
 
-
-
-void QuitScript::init(){
+void QuitScript::init() {
 	subscribe<KeyPressEvent>([this](const KeyPressEvent & ev) -> bool {
 		return this->on_event(ev);
 	});
diff --git a/game/QuitScript.h b/game/QuitScript.h
index af78ccf..b79a744 100644
--- a/game/QuitScript.h
+++ b/game/QuitScript.h
@@ -1,6 +1,5 @@
 #pragma once
 
-
 #include <crepe/api/Script.h>
 
 class QuitScript : public crepe::Script {
diff --git a/game/menus/ButtonNextMainMenuSubScript.cpp b/game/menus/ButtonNextMainMenuSubScript.cpp
index 631b4d3..63a2777 100644
--- a/game/menus/ButtonNextMainMenuSubScript.cpp
+++ b/game/menus/ButtonNextMainMenuSubScript.cpp
@@ -27,7 +27,7 @@ bool ButtonNextMainMenuSubScript::on_button_press(const ButtonPressEvent & e) {
 	for (AudioSource & audio : audios) {
 		audio.stop();
 	}
-	
+
 	this->trigger_event<DeleteRecordingEvent>();
 	SaveManager & savemgr = this->get_save_manager();
 
diff --git a/game/menus/ButtonReplaySubScript.cpp b/game/menus/ButtonReplaySubScript.cpp
index 55e718d..01cccbf 100644
--- a/game/menus/ButtonReplaySubScript.cpp
+++ b/game/menus/ButtonReplaySubScript.cpp
@@ -20,24 +20,24 @@ void ButtonReplaySubScript::init() {
 	this->subscribe<DeleteRecordingEvent>([this](const DeleteRecordingEvent & e) {
 		return this->delete_recording();
 	});
-	if(DISABLE_REPLAY)return;
+	if (DISABLE_REPLAY) return;
 	replay.record_start();
 }
 
 bool ButtonReplaySubScript::on_button_press(const ButtonPressEvent & e) {
-	if(DISABLE_REPLAY)return false;
+	if (DISABLE_REPLAY) return false;
 	replay.play(this->recording);
 	return false;
 }
 
 bool ButtonReplaySubScript::set_recording() {
-	if(DISABLE_REPLAY)return false;
+	if (DISABLE_REPLAY) return false;
 	this->recording = replay.record_end();
 	return false;
 }
 
 bool ButtonReplaySubScript::delete_recording() {
-	if(DISABLE_REPLAY)return false;
+	if (DISABLE_REPLAY) return false;
 	replay.release(this->recording);
 	return false;
 }
diff --git a/game/menus/ButtonSubScene.cpp b/game/menus/ButtonSubScene.cpp
index baf154c..1fe6b03 100644
--- a/game/menus/ButtonSubScene.cpp
+++ b/game/menus/ButtonSubScene.cpp
@@ -79,23 +79,22 @@ void ButtonSubScene::set_script(crepe::GameObject & button_object, const Data &
 				.set_script<ButtonShowCreditsSubScript>();
 			break;
 		case ScriptSelect::PREVIEW_REPLAY:
-			button_object.add_component<BehaviorScript>()
-				.set_script<PreviewReplaySubScript>();
+			button_object.add_component<BehaviorScript>().set_script<PreviewReplaySubScript>();
 			break;
 		case ScriptSelect::PREVIEW_START:
-			button_object.add_component<BehaviorScript>()
-				.set_script<PreviewStartRecSubScript>();
+			button_object.add_component<BehaviorScript>().set_script<PreviewStartRecSubScript>(
+			);
 			break;
 		case ScriptSelect::PREVIEW_STOP:
-		button_object.add_component<BehaviorScript>()
-				.set_script<PreviewStopRecSubScript>();
+			button_object.add_component<BehaviorScript>().set_script<PreviewStopRecSubScript>(
+			);
 			break;
 		case ScriptSelect::SHOP_BULLET:
-		button_object.add_component<BehaviorScript>()
+			button_object.add_component<BehaviorScript>()
 				.set_script<ButtonBuySelectBulletScript>();
 			break;
 		case ScriptSelect::SHOP_BUBBLE:
-		button_object.add_component<BehaviorScript>()
+			button_object.add_component<BehaviorScript>()
 				.set_script<ButtonBuySelectBubbleScript>();
 			break;
 		case ScriptSelect::NONE:
diff --git a/game/menus/endgame/EndGameSubScene.cpp b/game/menus/endgame/EndGameSubScene.cpp
index 0b72bdc..b33072a 100644
--- a/game/menus/endgame/EndGameSubScene.cpp
+++ b/game/menus/endgame/EndGameSubScene.cpp
@@ -73,21 +73,24 @@ void EndGameSubScene::create(Scene & scn) {
 			.world_space = false,
 			.text_color = Color::WHITE,
 		},
-		vec2 {0, Y_SPACING+Y_OFFSET} + FONTOFFSET, DISTANCE_STRING
+		vec2 {0, Y_SPACING + Y_OFFSET} + FONTOFFSET, DISTANCE_STRING
 	);
 
 	// Highscore
 	const string HIGHSCORE_STRING = "NEW HIGHSCORE";
 	GameObject highscore = scn.new_object("highscore_endgame", "highscore_tag_end");
 	crepe::vec2 size_highscore = {200, (200.0f / HIGHSCORE_STRING.size()) * 2};
-	highscore.add_component<Text>(
-		size_highscore, FONT,
-		Text::Data {
-			.world_space = false,
-			.text_color = Color::WHITE,
-		},
-		vec2 {0, Y_SPACING*2+Y_OFFSET} + FONTOFFSET, HIGHSCORE_STRING
-	).active = false;
+	highscore
+		.add_component<Text>(
+			size_highscore, FONT,
+			Text::Data {
+				.world_space = false,
+				.text_color = Color::WHITE,
+			},
+			vec2 {0, Y_SPACING * 2 + Y_OFFSET} + FONTOFFSET, HIGHSCORE_STRING
+		)
+		.active
+		= false;
 
 	// Buttons
 	vec2 button_position = {190, 190};
diff --git a/game/menus/endgame/EndGameSubScript.cpp b/game/menus/endgame/EndGameSubScript.cpp
index e081350..6793f3e 100644
--- a/game/menus/endgame/EndGameSubScript.cpp
+++ b/game/menus/endgame/EndGameSubScript.cpp
@@ -1,9 +1,9 @@
 #include "EndGameSubScript.h"
 
+#include "../../Config.h"
 #include "../../Events.h"
 #include "../ButtonReplaySubScript.h"
 #include "../IFloatingWindowScript.h"
-#include "../../Config.h"
 #include "ValueBroker.h"
 #include "manager/SaveManager.h"
 
@@ -60,11 +60,13 @@ bool EndGameSubScript::reset_timescale() {
 	return false;
 }
 
-bool EndGameSubScript::showscore(){
-	// Gather text 
+bool EndGameSubScript::showscore() {
+	// Gather text
 	Text & coins_text = this->get_components_by_name<Text>("gold_endgame").front().get();
-	Text & distance_text = this->get_components_by_name<Text>("distance_endgame").front().get();
-	Text & highscore_text = this->get_components_by_name<Text>("highscore_endgame").front().get();
+	Text & distance_text
+		= this->get_components_by_name<Text>("distance_endgame").front().get();
+	Text & highscore_text
+		= this->get_components_by_name<Text>("highscore_endgame").front().get();
 	highscore_text.active = false;
 
 	// Gather saved data
@@ -75,20 +77,24 @@ bool EndGameSubScript::showscore(){
 	int distance_game = savemgr.get<int>(DISTANCE_GAME, 0).get();
 
 	// Show highscore
-	if(distance_run > distance_game) highscore_text.active = true;
+	if (distance_run > distance_game) highscore_text.active = true;
 
 	const float CHAR_SIZE_DIS = 20;
 	// Show distance
-	std::string distance_string = "DISTANCE:" + distance.get(); 
+	std::string distance_string = "DISTANCE:" + distance.get();
 	distance_text.text = distance_string;
-	crepe::vec2 size_distance = {CHAR_SIZE_DIS*distance_string.size(), (CHAR_SIZE_DIS*distance_string.size() / distance_string.size()) * 2};
+	crepe::vec2 size_distance
+		= {CHAR_SIZE_DIS * distance_string.size(),
+		   (CHAR_SIZE_DIS * distance_string.size() / distance_string.size()) * 2};
 	distance_text.dimensions = size_distance;
 
 	const float CHAR_SIZE_COIN = 16;
 	// Show coins
-	std::string coins_string = "Coins:" + coins.get(); 
+	std::string coins_string = "Coins:" + coins.get();
 	coins_text.text = coins_string;
-	crepe::vec2 size_coins = {CHAR_SIZE_COIN*coins_string.size(), (CHAR_SIZE_COIN*coins_string.size() / coins_string.size()) * 2};
+	crepe::vec2 size_coins
+		= {CHAR_SIZE_COIN * coins_string.size(),
+		   (CHAR_SIZE_COIN * coins_string.size() / coins_string.size()) * 2};
 	coins_text.dimensions = size_coins;
 
 	return false;
diff --git a/game/menus/shop/ButtonBuySelectBubbleScript.cpp b/game/menus/shop/ButtonBuySelectBubbleScript.cpp
index 21dbe1a..741afde 100644
--- a/game/menus/shop/ButtonBuySelectBubbleScript.cpp
+++ b/game/menus/shop/ButtonBuySelectBubbleScript.cpp
@@ -17,19 +17,17 @@ void ButtonBuySelectBubbleScript::init() {
 
 bool ButtonBuySelectBubbleScript::on_button_press(const ButtonPressEvent & e) {
 	SaveManager & save = this->get_save_manager();
-	ValueBroker<int> buy_bullet = save.get<int>(BUY_BUBBLE_SAVE,0);
-	if(!buy_bullet.get()){
-		ValueBroker<int> coins = save.get<int>(TOTAL_COINS_GAME,0);
-		if(coins.get() >= 1000)
-		{
+	ValueBroker<int> buy_bullet = save.get<int>(BUY_BUBBLE_SAVE, 0);
+	if (!buy_bullet.get()) {
+		ValueBroker<int> coins = save.get<int>(TOTAL_COINS_GAME, 0);
+		if (coins.get() >= 1000) {
 			int coin = coins.get();
 			coin -= 1000;
-			save.set(TOTAL_COINS_GAME,coin);
-			save.set(BUY_BUBBLE_SAVE,1);
+			save.set(TOTAL_COINS_GAME, coin);
+			save.set(BUY_BUBBLE_SAVE, 1);
 		}
-	}
-	else {
-		save.set(JETPACK_PARTICLES,1);
+	} else {
+		save.set(JETPACK_PARTICLES, 1);
 	}
 	this->trigger_event<ShopUpdate>();
 	return false;
diff --git a/game/menus/shop/ButtonBuySelectBulletScript.cpp b/game/menus/shop/ButtonBuySelectBulletScript.cpp
index 71d8b76..d30849c 100644
--- a/game/menus/shop/ButtonBuySelectBulletScript.cpp
+++ b/game/menus/shop/ButtonBuySelectBulletScript.cpp
@@ -17,19 +17,17 @@ void ButtonBuySelectBulletScript::init() {
 
 bool ButtonBuySelectBulletScript::on_button_press(const ButtonPressEvent & e) {
 	SaveManager & save = this->get_save_manager();
-	ValueBroker<int> buy_bullet = save.get<int>(BUY_BULLET_SAVE,0);
-	if(!buy_bullet.get()){
-		ValueBroker<int> coins = save.get<int>(TOTAL_COINS_GAME,0);
-		if(coins.get() >= 0)
-		{
+	ValueBroker<int> buy_bullet = save.get<int>(BUY_BULLET_SAVE, 0);
+	if (!buy_bullet.get()) {
+		ValueBroker<int> coins = save.get<int>(TOTAL_COINS_GAME, 0);
+		if (coins.get() >= 0) {
 			int coin = coins.get();
 			coin -= 0;
-			save.set(TOTAL_COINS_GAME,coin);
-			save.set(BUY_BULLET_SAVE,1);
+			save.set(TOTAL_COINS_GAME, coin);
+			save.set(BUY_BULLET_SAVE, 1);
 		}
-	}
-	else {
-		save.set(JETPACK_PARTICLES,0);
+	} else {
+		save.set(JETPACK_PARTICLES, 0);
 	}
 	this->trigger_event<ShopUpdate>();
 	return false;
diff --git a/game/menus/shop/ShopLoadScript.cpp b/game/menus/shop/ShopLoadScript.cpp
index a9f9bfe..a545fe2 100644
--- a/game/menus/shop/ShopLoadScript.cpp
+++ b/game/menus/shop/ShopLoadScript.cpp
@@ -1,129 +1,124 @@
 #include "ShopLoadScript.h"
-#include <crepe/ValueBroker.h>
+#include "Shopconfig.h"
 #include "api/Button.h"
 #include "api/Sprite.h"
-#include "Shopconfig.h"
 #include "api/Text.h"
 #include "manager/SaveManager.h"
+#include <crepe/ValueBroker.h>
 
 using namespace crepe;
 using namespace std;
 
 void ShopLoadScript::init() {
 	this->update();
-	this->subscribe<ShopUpdate>([this](const ShopUpdate e) {
-		return this->update();
-	});
+	this->subscribe<ShopUpdate>([this](const ShopUpdate e) { return this->update(); });
 }
 
-bool ShopLoadScript::update(){
+bool ShopLoadScript::update() {
 	SaveManager & save = this->get_save_manager();
-	ValueBroker<int> buy_bullet = save.get<int>(BUY_BULLET_SAVE,0);
-	ValueBroker<int> buy_bubble = save.get<int>(BUY_BUBBLE_SAVE,0);
+	ValueBroker<int> buy_bullet = save.get<int>(BUY_BULLET_SAVE, 0);
+	ValueBroker<int> buy_bubble = save.get<int>(BUY_BUBBLE_SAVE, 0);
 
-
-	if(buy_bullet.get()){
+	if (buy_bullet.get()) {
 		auto sprites = this->get_components_by_tag<Sprite>(BUY_BULLET);
-		for(auto sprite : sprites){
+		for (auto sprite : sprites) {
 			sprite.get().active = false;
 		}
 		auto buttons = this->get_components_by_tag<Button>(BUY_BULLET);
-		for(auto btn : buttons){
+		for (auto btn : buttons) {
 			btn.get().active = false;
 		}
 		auto texts = this->get_components_by_tag<Text>(BUY_BULLET);
-		for(auto txt : texts){
+		for (auto txt : texts) {
 			txt.get().active = false;
 		}
 		auto sprites1 = this->get_components_by_tag<Sprite>(SELECT_BULLET);
-		for(auto sprite : sprites1){
+		for (auto sprite : sprites1) {
 			sprite.get().active = true;
 		}
 		auto buttons1 = this->get_components_by_tag<Button>(SELECT_BULLET);
-		for(auto btn : buttons1){
+		for (auto btn : buttons1) {
 			btn.get().active = true;
 		}
 		auto texts1 = this->get_components_by_tag<Text>(SELECT_BULLET);
-		for(auto txt : texts1){
+		for (auto txt : texts1) {
 			txt.get().active = true;
 		}
-	}
-	else {
+	} else {
 		auto sprites = this->get_components_by_tag<Sprite>(SELECT_BULLET);
-		for(auto sprite : sprites){
+		for (auto sprite : sprites) {
 			sprite.get().active = false;
 		}
 		auto buttons = this->get_components_by_tag<Button>(SELECT_BULLET);
-		for(auto btn : buttons){
+		for (auto btn : buttons) {
 			btn.get().active = false;
 		}
 		auto texts = this->get_components_by_tag<Text>(SELECT_BULLET);
-		for(auto txt : texts){
+		for (auto txt : texts) {
 			txt.get().active = false;
 		}
 		auto sprites1 = this->get_components_by_tag<Sprite>(BUY_BULLET);
-		for(auto sprite : sprites1){
+		for (auto sprite : sprites1) {
 			sprite.get().active = true;
 		}
 		auto buttons1 = this->get_components_by_tag<Button>(BUY_BULLET);
-		for(auto btn : buttons1){
+		for (auto btn : buttons1) {
 			btn.get().active = true;
 		}
 		auto texts1 = this->get_components_by_tag<Text>(BUY_BULLET);
-		for(auto txt : texts1){
+		for (auto txt : texts1) {
 			txt.get().active = true;
 		}
 	}
 
-	if(buy_bubble.get()){
+	if (buy_bubble.get()) {
 		auto sprites = this->get_components_by_tag<Sprite>(BUY_BUBBLE);
-		for(auto sprite : sprites){
+		for (auto sprite : sprites) {
 			sprite.get().active = false;
 		}
 		auto buttons = this->get_components_by_tag<Button>(BUY_BUBBLE);
-		for(auto btn : buttons){
+		for (auto btn : buttons) {
 			btn.get().active = false;
 		}
 		auto texts = this->get_components_by_tag<Text>(BUY_BUBBLE);
-		for(auto txt : texts){
+		for (auto txt : texts) {
 			txt.get().active = false;
 		}
 		auto sprites1 = this->get_components_by_tag<Sprite>(SELECT_BUBBLE);
-		for(auto sprite : sprites1){
+		for (auto sprite : sprites1) {
 			sprite.get().active = true;
 		}
 		auto buttons1 = this->get_components_by_tag<Button>(SELECT_BUBBLE);
-		for(auto btn : buttons1){
+		for (auto btn : buttons1) {
 			btn.get().active = true;
 		}
 		auto texts1 = this->get_components_by_tag<Text>(SELECT_BUBBLE);
-		for(auto txt : texts1){
+		for (auto txt : texts1) {
 			txt.get().active = true;
 		}
-	}
-	else {
+	} else {
 		auto sprites = this->get_components_by_tag<Sprite>(SELECT_BUBBLE);
-		for(auto sprite : sprites){
+		for (auto sprite : sprites) {
 			sprite.get().active = false;
 		}
 		auto buttons = this->get_components_by_tag<Button>(SELECT_BUBBLE);
-		for(auto btn : buttons){
+		for (auto btn : buttons) {
 			btn.get().active = false;
 		}
 		auto texts = this->get_components_by_tag<Text>(SELECT_BUBBLE);
-		for(auto txt : texts){
+		for (auto txt : texts) {
 			txt.get().active = false;
 		}
 		auto sprites1 = this->get_components_by_tag<Sprite>(BUY_BUBBLE);
-		for(auto sprite : sprites1){
+		for (auto sprite : sprites1) {
 			sprite.get().active = true;
 		}
 		auto buttons1 = this->get_components_by_tag<Button>(BUY_BUBBLE);
-		for(auto btn : buttons1){
+		for (auto btn : buttons1) {
 			btn.get().active = true;
 		}
 		auto texts1 = this->get_components_by_tag<Text>(BUY_BUBBLE);
-		for(auto txt : texts1){
+		for (auto txt : texts1) {
 			txt.get().active = true;
 		}
 	}
diff --git a/game/menus/shop/ShopMenuScene.cpp b/game/menus/shop/ShopMenuScene.cpp
index fc7323b..641352c 100644
--- a/game/menus/shop/ShopMenuScene.cpp
+++ b/game/menus/shop/ShopMenuScene.cpp
@@ -9,10 +9,10 @@
 #include "menus/shop/ShopLoadScript.h"
 #include "types.h"
 
+#include "Shopconfig.h"
 #include <crepe/api/Camera.h>
 #include <crepe/api/Sprite.h>
 #include <crepe/api/Text.h>
-#include "Shopconfig.h"
 
 using namespace crepe;
 using namespace std;
@@ -58,8 +58,6 @@ void ShopMenuScene::load_scene() {
 		}
 	);
 
-
-
 	const float CHAR_SIZE = 16;
 	const float CHAR_SIZE_COIN = 16;
 	crepe::vec2 size;
@@ -75,7 +73,9 @@ void ShopMenuScene::load_scene() {
 	);
 
 	const string BULLETS_STRING = "BULLETS";
-	size = {CHAR_SIZE*BULLETS_STRING.size(), (CHAR_SIZE*BULLETS_STRING.size() / BULLETS_STRING.size()) * 2};
+	size
+		= {CHAR_SIZE * BULLETS_STRING.size(),
+		   (CHAR_SIZE * BULLETS_STRING.size() / BULLETS_STRING.size()) * 2};
 
 	shop_item_bullet.add_component<Text>(
 		size, FONT,
@@ -95,7 +95,9 @@ void ShopMenuScene::load_scene() {
 	);
 
 	const string BULLETS_GOLD_STRING = "0";
-	size = {CHAR_SIZE_COIN*BULLETS_GOLD_STRING.size(), (CHAR_SIZE_COIN*BULLETS_GOLD_STRING.size() / BULLETS_GOLD_STRING.size()) * 2};
+	size
+		= {CHAR_SIZE_COIN * BULLETS_GOLD_STRING.size(),
+		   (CHAR_SIZE_COIN * BULLETS_GOLD_STRING.size() / BULLETS_GOLD_STRING.size()) * 2};
 	shop_item_bullet.add_component<Text>(
 		size, FONT,
 		Text::Data {
@@ -116,7 +118,9 @@ void ShopMenuScene::load_scene() {
 	);
 
 	const string BUBBLE_STRING = "BUBBLE";
-	size = {CHAR_SIZE*BUBBLE_STRING.size(), (CHAR_SIZE*BUBBLE_STRING.size() / BUBBLE_STRING.size()) * 2};
+	size
+		= {CHAR_SIZE * BUBBLE_STRING.size(),
+		   (CHAR_SIZE * BUBBLE_STRING.size() / BUBBLE_STRING.size()) * 2};
 	shop_item_bubble.add_component<Text>(
 		size, FONT,
 		Text::Data {
@@ -135,7 +139,9 @@ void ShopMenuScene::load_scene() {
 	);
 
 	const string BUBBLE_GOLD_STRING = "1000";
-	size = {CHAR_SIZE_COIN*BUBBLE_GOLD_STRING.size(), (CHAR_SIZE_COIN*BUBBLE_GOLD_STRING.size() / BUBBLE_GOLD_STRING.size()) * 2};
+	size
+		= {CHAR_SIZE_COIN * BUBBLE_GOLD_STRING.size(),
+		   (CHAR_SIZE_COIN * BUBBLE_GOLD_STRING.size() / BUBBLE_GOLD_STRING.size()) * 2};
 	shop_item_bubble.add_component<Text>(
 		size, FONT,
 		Text::Data {
@@ -205,7 +211,6 @@ void ShopMenuScene::load_scene() {
 			.btn_side_color = ButtonSubScene::ButtonSideColor::PURPLE
 		}
 	);
-
 }
 
 string ShopMenuScene::get_name() const { return SHOP_SCENE; }
diff --git a/game/menus/shop/Shopconfig.h b/game/menus/shop/Shopconfig.h
index 04c8c5c..a686242 100644
--- a/game/menus/shop/Shopconfig.h
+++ b/game/menus/shop/Shopconfig.h
@@ -7,10 +7,8 @@ static constexpr const char * SELECT_BULLET = "SELECT_BULLET";
 static constexpr const char * BUY_BUBBLE = "BUY_BUBBLE";
 static constexpr const char * SELECT_BUBBLE = "SELECT_BUBBLE";
 
-
 //save_data
 static constexpr const char * BUY_BULLET_SAVE = "BUY_BULLET_SAVE";
 static constexpr const char * BUY_BUBBLE_SAVE = "BUY_BUBBLE_SAVE";
 
-
 struct ShopUpdate : public crepe::Event {};
diff --git a/game/missile/AlertSubScene.cpp b/game/missile/AlertSubScene.cpp
index 8d59f97..5bce5ac 100644
--- a/game/missile/AlertSubScene.cpp
+++ b/game/missile/AlertSubScene.cpp
@@ -7,7 +7,7 @@
 
 using namespace crepe;
 
-MissileAlert::MissileAlert(Scene& scn){
+MissileAlert::MissileAlert(Scene & scn) {
 	GameObject alert = scn.new_object("missile_alert", "missile_alert", {0, 0}, 0, 1);
 
 	Asset missile_alert_ss {"asset/obstacles/missile/missileAlert.png"};
@@ -30,6 +30,4 @@ MissileAlert::MissileAlert(Scene& scn){
 
 	missile_alert_anim.set_anim(1);
 	missile_alert_sprite.active = false;
-
-
 }
diff --git a/game/missile/MissileScript.cpp b/game/missile/MissileScript.cpp
index 797e1ac..bcc4f5b 100644
--- a/game/missile/MissileScript.cpp
+++ b/game/missile/MissileScript.cpp
@@ -2,17 +2,17 @@
 #include "../Config.h"
 #include <cmath>
 
-#include <crepe/api/CircleCollider.h>
-#include <crepe/api/Rigidbody.h>
-#include <crepe/api/BehaviorScript.h>
+#include <crepe/api/AI.h>
 #include <crepe/api/Animator.h>
 #include <crepe/api/AudioSource.h>
+#include <crepe/api/BehaviorScript.h>
+#include <crepe/api/CircleCollider.h>
+#include <crepe/api/KeyCodes.h>
+#include <crepe/api/Rigidbody.h>
+#include <crepe/api/Sprite.h>
 #include <crepe/api/Transform.h>
 #include <crepe/system/CollisionSystem.h>
 #include <crepe/types.h>
-#include <crepe/api/AI.h>
-#include <crepe/api/KeyCodes.h>
-#include <crepe/api/Sprite.h>
 
 using namespace std;
 using namespace crepe;
diff --git a/game/missile/MissileSubScene.cpp b/game/missile/MissileSubScene.cpp
index 6df6c87..d325050 100644
--- a/game/missile/MissileSubScene.cpp
+++ b/game/missile/MissileSubScene.cpp
@@ -87,14 +87,13 @@ void MissileSubScene::create(crepe::Scene & scn) {
 	missile_explosion_sprite.active = false;
 	explosion_anim.active = false;
 
-	missle
-		.add_component<Rigidbody>(Rigidbody::Data {
-			.body_type = Rigidbody::BodyType::KINEMATIC,
-			.max_linear_velocity = Random::f(250, 200),
-			.kinematic_collision = false,
-			.collision_layers = {COLL_LAY_PLAYER, COLL_LAY_BOT_TOP},
-			.collision_layer = COLL_LAY_MISSILE,
-		});
+	missle.add_component<Rigidbody>(Rigidbody::Data {
+		.body_type = Rigidbody::BodyType::KINEMATIC,
+		.max_linear_velocity = Random::f(250, 200),
+		.kinematic_collision = false,
+		.collision_layers = {COLL_LAY_PLAYER, COLL_LAY_BOT_TOP},
+		.collision_layer = COLL_LAY_MISSILE,
+	});
 
 	missle.add_component<CircleCollider>(3).active = false;
 
diff --git a/game/missile/SpawnEvent.cpp b/game/missile/SpawnEvent.cpp
index a54d0a5..c7209b7 100644
--- a/game/missile/SpawnEvent.cpp
+++ b/game/missile/SpawnEvent.cpp
@@ -1,12 +1,11 @@
 #include "SpawnEvent.h"
 #include "Random.h"
 
-
-#include <crepe/api/CircleCollider.h>
 #include <crepe/api/Animator.h>
 #include <crepe/api/AudioSource.h>
 #include <crepe/api/BehaviorScript.h>
 #include <crepe/api/Camera.h>
+#include <crepe/api/CircleCollider.h>
 #include <crepe/api/Sprite.h>
 #include <crepe/api/Transform.h>
 
@@ -40,7 +39,6 @@ bool MissileSpawnEventHandler::on_event(const MissileSpawnEvent & event) {
 		transform.position.x = camera_transform.position.x + this->MISSILE_OFFSET;
 		transform.position.y = Random::i(this->MAX_RANGE, this->MIN_RANGE);
 
-
 		auto & alert_transform = alert_transforms[i].get();
 		auto & alert_sprite = alert_sprites[i].get();
 		alert_sprite.active = true;
diff --git a/game/preview/PreviewReplaySubScript.cpp b/game/preview/PreviewReplaySubScript.cpp
index 51c27aa..580a608 100644
--- a/game/preview/PreviewReplaySubScript.cpp
+++ b/game/preview/PreviewReplaySubScript.cpp
@@ -21,17 +21,16 @@ void PreviewReplaySubScript::init() {
 	this->subscribe<StartPreviewRecording>([this](const StartPreviewRecording & e) {
 		return this->start_recording();
 	});
-	
 }
 
 bool PreviewReplaySubScript::on_button_press(const ButtonPressEvent & e) {
-	if(DISABLE_REPLAY)return false;
+	if (DISABLE_REPLAY) return false;
 	replay.play(this->recording);
 	return false;
 }
-bool PreviewReplaySubScript::start_recording(){
-	if(DISABLE_REPLAY)return false;
-	if(record_saved){
+bool PreviewReplaySubScript::start_recording() {
+	if (DISABLE_REPLAY) return false;
+	if (record_saved) {
 		this->stop_recording();
 		this->delete_recording();
 	}
@@ -41,16 +40,16 @@ bool PreviewReplaySubScript::start_recording(){
 }
 
 bool PreviewReplaySubScript::stop_recording() {
-	if(DISABLE_REPLAY)return false;
-	if(this->record_started)this->recording = replay.record_end();
+	if (DISABLE_REPLAY) return false;
+	if (this->record_started) this->recording = replay.record_end();
 	this->record_saved = true;
 	return false;
 }
 
 bool PreviewReplaySubScript::delete_recording() {
-	if(DISABLE_REPLAY)return false;
-	if(this->record_started) this->stop_recording();
-	if(this->record_saved)replay.release(this->recording);
+	if (DISABLE_REPLAY) return false;
+	if (this->record_started) this->stop_recording();
+	if (this->record_saved) replay.release(this->recording);
 	this->record_saved = false;
 	return false;
 }
diff --git a/game/preview/PreviewReplaySubScript.h b/game/preview/PreviewReplaySubScript.h
index ca5bd08..59b78c3 100644
--- a/game/preview/PreviewReplaySubScript.h
+++ b/game/preview/PreviewReplaySubScript.h
@@ -17,6 +17,7 @@ private:
 	bool start_recording();
 	bool stop_recording();
 	bool delete_recording();
+
 private:
 	bool record_saved = false;
 	bool record_started = false;
diff --git a/game/preview/PreviewStartRecSubScript.cpp b/game/preview/PreviewStartRecSubScript.cpp
index 194f849..8a2f54c 100644
--- a/game/preview/PreviewStartRecSubScript.cpp
+++ b/game/preview/PreviewStartRecSubScript.cpp
@@ -12,7 +12,6 @@ void PreviewStartRecSubScript::init() {
 	this->subscribe<ButtonPressEvent>([this](const ButtonPressEvent & e) {
 		return this->on_button_press(e);
 	});
-	
 }
 
 bool PreviewStartRecSubScript::on_button_press(const ButtonPressEvent & e) {
diff --git a/game/preview/PreviewStopRecSubScript.cpp b/game/preview/PreviewStopRecSubScript.cpp
index c674a8b..a229da8 100644
--- a/game/preview/PreviewStopRecSubScript.cpp
+++ b/game/preview/PreviewStopRecSubScript.cpp
@@ -12,7 +12,6 @@ void PreviewStopRecSubScript::init() {
 	this->subscribe<ButtonPressEvent>([this](const ButtonPressEvent & e) {
 		return this->on_button_press(e);
 	});
-	
 }
 
 bool PreviewStopRecSubScript::on_button_press(const ButtonPressEvent & e) {
-- 
cgit v1.2.3