aboutsummaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2025-01-08 15:44:51 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2025-01-08 15:44:51 +0100
commit94e2988cc8c42e83a4b7b858c48458f997130963 (patch)
tree633abef48dc65e170b2c184ec68beb4154fcdb2a /game
parent12cf43dd062f41af226e0ac038b2f2838391015f (diff)
parent26fe39ef4e633206a9b202d431c969c66052d2ef (diff)
merge w/ master
Diffstat (limited to 'game')
-rw-r--r--game/CMakeLists.txt4
-rw-r--r--game/Config.h2
-rw-r--r--game/hud/HudSubScene.cpp2
-rw-r--r--game/hud/SpeedScript.cpp2
-rw-r--r--game/hud/SpeedScript.h2
-rw-r--r--game/menus/ButtonReplaySubScript.cpp30
-rw-r--r--game/menus/ButtonReplaySubScript.h18
-rw-r--r--game/menus/ButtonShowCreditsSubScript.cpp20
-rw-r--r--game/menus/ButtonShowCreditsSubScript.h14
-rw-r--r--game/menus/ButtonSubScene.cpp14
-rw-r--r--game/menus/ButtonSubScene.h3
-rw-r--r--game/menus/endgame/EndGameSubScene.cpp2
-rw-r--r--game/menus/endgame/EndGameSubScript.cpp1
-rw-r--r--game/menus/mainmenu/CreditsSubScene.cpp132
-rw-r--r--game/menus/mainmenu/CreditsSubScene.h9
-rw-r--r--game/menus/mainmenu/CreditsSubScript.cpp58
-rw-r--r--game/menus/mainmenu/CreditsSubScript.h18
-rw-r--r--game/menus/mainmenu/MainMenuScene.cpp19
-rw-r--r--game/menus/shop/ShopMenuScene.cpp70
-rw-r--r--game/player/PlayerEndScript.cpp2
20 files changed, 417 insertions, 5 deletions
diff --git a/game/CMakeLists.txt b/game/CMakeLists.txt
index 4d02633..497b880 100644
--- a/game/CMakeLists.txt
+++ b/game/CMakeLists.txt
@@ -36,14 +36,18 @@ target_sources(main PUBLIC
menus/IButtonScript.cpp
menus/ButtonSetShopSubScript.cpp
menus/ButtonSetMainMenuSubScript.cpp
+ menus/ButtonReplaySubScript.cpp
menus/ButtonNextMainMenuSubScript.cpp
menus/FloatingWindowSubScene.cpp
menus/IFloatingWindowScript.cpp
+ menus/ButtonShowCreditsSubScript.cpp
menus/shop/ShopMenuScene.cpp
menus/mainmenu/ButtonTransitionPreviewSubScript.cpp
menus/mainmenu/ITransitionScript.cpp
menus/mainmenu/MainMenuScene.cpp
menus/mainmenu/TransitionStartSubScript.cpp
+ menus/mainmenu/CreditsSubScene.cpp
+ menus/mainmenu/CreditsSubScript.cpp
menus/endgame/EndGameSubScene.cpp
menus/endgame/EndGameSubScript.cpp
coins/CoinSubScene.cpp
diff --git a/game/Config.h b/game/Config.h
index 580e9ec..37be1a6 100644
--- a/game/Config.h
+++ b/game/Config.h
@@ -59,3 +59,5 @@ static constexpr int PLAYER_SPEED = 7500; // In game units
static constexpr int PLAYER_GRAVITY_SCALE = 60; // In game units
static constexpr const char * CAMERA_NAME = "camera";
+// Jetpack particles
+static constexpr const char * JETPACK_PARTICLES = "jetpack_particles";
diff --git a/game/hud/HudSubScene.cpp b/game/hud/HudSubScene.cpp
index ca81614..dcc07b4 100644
--- a/game/hud/HudSubScene.cpp
+++ b/game/hud/HudSubScene.cpp
@@ -45,7 +45,7 @@ void HudSubScene::create(Scene & scn) {
size_coin, FONT,
Text::Data {
.world_space = false,
- .text_color = Color::YELLOW,
+ .text_color = Color::GOLD,
},
TOP_LEFT + FONTOFFSET + COINS_OFFSET + vec2 {COINS_LENGTH * COINS_CHAR_WIDTH / 2, 0},
COINS
diff --git a/game/hud/SpeedScript.cpp b/game/hud/SpeedScript.cpp
index d0a4dfe..906a38f 100644
--- a/game/hud/SpeedScript.cpp
+++ b/game/hud/SpeedScript.cpp
@@ -26,9 +26,11 @@ void SpeedScript::init() {
void SpeedScript::fixed_update(crepe::duration_t dt) {
LoopTimerManager & lp = this->get_loop_timer();
if (this->get_key_state(Keycode::PAGE_UP)) {
+ if (lp.get_time_scale() >= 2) return;
lp.set_time_scale(lp.get_time_scale() + 0.1);
}
if (this->get_key_state(Keycode::PAGE_DOWN)) {
+ if (lp.get_time_scale() <= 0.5) return;
lp.set_time_scale(lp.get_time_scale() - 0.1);
}
}
diff --git a/game/hud/SpeedScript.h b/game/hud/SpeedScript.h
index 6c15a89..b40f7cc 100644
--- a/game/hud/SpeedScript.h
+++ b/game/hud/SpeedScript.h
@@ -10,6 +10,6 @@ public:
private:
crepe::SaveManager * savemgr;
- bool toggle = true;
+ bool toggle = false;
float timescale = 1;
};
diff --git a/game/menus/ButtonReplaySubScript.cpp b/game/menus/ButtonReplaySubScript.cpp
new file mode 100644
index 0000000..9308350
--- /dev/null
+++ b/game/menus/ButtonReplaySubScript.cpp
@@ -0,0 +1,30 @@
+#include "ButtonReplaySubScript.h"
+#include "MenusConfig.h"
+
+#include "../Events.h"
+#include <crepe/api/AudioSource.h>
+#include <crepe/types.h>
+
+using namespace crepe;
+using namespace std;
+
+void ButtonReplaySubScript::init() {
+ IButtonScript::init();
+ this->subscribe<ButtonPressEvent>([this](const ButtonPressEvent & e) {
+ return this->on_button_press(e);
+ });
+ this->subscribe<EndGameEvent>([this](const EndGameEvent & e) {
+ return this->set_recording();
+ });
+ replay.record_start();
+}
+
+bool ButtonReplaySubScript::on_button_press(const ButtonPressEvent & e) {
+ replay.play(this->recording);
+ return false;
+}
+
+bool ButtonReplaySubScript::set_recording() {
+ this->recording = replay.record_end();
+ return false;
+}
diff --git a/game/menus/ButtonReplaySubScript.h b/game/menus/ButtonReplaySubScript.h
new file mode 100644
index 0000000..bfc684d
--- /dev/null
+++ b/game/menus/ButtonReplaySubScript.h
@@ -0,0 +1,18 @@
+#pragma once
+
+#include "IButtonScript.h"
+
+#include <crepe/api/Script.h>
+
+class ButtonReplaySubScript : public IButtonScript {
+public:
+ void init() override;
+ bool on_button_press(const crepe::ButtonPressEvent & e);
+
+private:
+ crepe::recording_t recording = 0;
+ bool set_recording();
+
+protected:
+ bool transition = false;
+};
diff --git a/game/menus/ButtonShowCreditsSubScript.cpp b/game/menus/ButtonShowCreditsSubScript.cpp
new file mode 100644
index 0000000..ec0e980
--- /dev/null
+++ b/game/menus/ButtonShowCreditsSubScript.cpp
@@ -0,0 +1,20 @@
+#include "ButtonShowCreditsSubScript.h"
+#include "MenusConfig.h"
+#include "mainmenu/CreditsSubScript.h"
+#include <crepe/api/AudioSource.h>
+#include <crepe/types.h>
+
+using namespace crepe;
+using namespace std;
+
+void ButtonShowCreditsSubScript::init() {
+ IButtonScript::init();
+ this->subscribe<ButtonPressEvent>([this](const ButtonPressEvent & e) {
+ return this->on_button_press(e);
+ });
+}
+
+bool ButtonShowCreditsSubScript::on_button_press(const ButtonPressEvent & e) {
+ this->trigger_event<ShowCreditsEvent>();
+ return false;
+}
diff --git a/game/menus/ButtonShowCreditsSubScript.h b/game/menus/ButtonShowCreditsSubScript.h
new file mode 100644
index 0000000..3c73c44
--- /dev/null
+++ b/game/menus/ButtonShowCreditsSubScript.h
@@ -0,0 +1,14 @@
+#pragma once
+
+#include "IButtonScript.h"
+
+#include <crepe/api/Script.h>
+
+class ButtonShowCreditsSubScript : public IButtonScript {
+public:
+ void init() override;
+ bool on_button_press(const crepe::ButtonPressEvent & e);
+
+protected:
+ bool transition = false;
+};
diff --git a/game/menus/ButtonSubScene.cpp b/game/menus/ButtonSubScene.cpp
index e41c798..30646f1 100644
--- a/game/menus/ButtonSubScene.cpp
+++ b/game/menus/ButtonSubScene.cpp
@@ -1,13 +1,16 @@
#include "ButtonSubScene.h"
#include "ButtonNextMainMenuSubScript.h"
+#include "ButtonReplaySubScript.h"
#include "ButtonSetMainMenuSubScript.h"
#include "ButtonSetShopSubScript.h"
+#include "ButtonShowCreditsSubScript.h"
#include "IButtonScript.h"
#include "MenusConfig.h"
#include "mainmenu/ButtonTransitionPreviewSubScript.h"
#include "../Config.h"
+#include "mainmenu/CreditsSubScript.h"
#include <crepe/api/BehaviorScript.h>
#include <crepe/api/Button.h>
@@ -58,6 +61,17 @@ void ButtonSubScene::set_script(crepe::GameObject & button_object, const Data &
button_object.add_component<BehaviorScript>()
.set_script<ButtonNextMainMenuSubScript>();
break;
+ case ScriptSelect::REPLAY:
+ button_object.add_component<BehaviorScript>().set_script<ButtonReplaySubScript>();
+ break;
+ case ScriptSelect::CREDITS_BACK:
+ button_object.add_component<BehaviorScript>().set_script<CreditsSubScript>(data.tag
+ );
+ break;
+ case ScriptSelect::CREDITS_SHOW:
+ button_object.add_component<BehaviorScript>()
+ .set_script<ButtonShowCreditsSubScript>();
+ break;
case ScriptSelect::NONE:
button_object.add_component<BehaviorScript>().set_script<IButtonScript>();
break;
diff --git a/game/menus/ButtonSubScene.h b/game/menus/ButtonSubScene.h
index c1c6de8..74f9464 100644
--- a/game/menus/ButtonSubScene.h
+++ b/game/menus/ButtonSubScene.h
@@ -16,6 +16,9 @@ public:
SHOP,
MAINMENU,
NEXT,
+ REPLAY,
+ CREDITS_SHOW,
+ CREDITS_BACK,
NONE,
};
//icon enum
diff --git a/game/menus/endgame/EndGameSubScene.cpp b/game/menus/endgame/EndGameSubScene.cpp
index 3ef0f9a..a6f8b25 100644
--- a/game/menus/endgame/EndGameSubScene.cpp
+++ b/game/menus/endgame/EndGameSubScene.cpp
@@ -71,7 +71,7 @@ void EndGameSubScene::create(Scene & scn) {
.text = "REPLAY",
.text_width = 150,
.position = {-button_position.x, button_position.y},
- // .script_type = ButtonSubScene::ScriptSelect::MAINMENU,
+ .script_type = ButtonSubScene::ScriptSelect::REPLAY,
.button_type = ButtonSubScene::ButtonSelect::BACK,
.scale = 0.6,
.worldspace = false,
diff --git a/game/menus/endgame/EndGameSubScript.cpp b/game/menus/endgame/EndGameSubScript.cpp
index f120e2d..6edfe7b 100644
--- a/game/menus/endgame/EndGameSubScript.cpp
+++ b/game/menus/endgame/EndGameSubScript.cpp
@@ -1,6 +1,7 @@
#include "EndGameSubScript.h"
#include "../../Events.h"
+#include "../ButtonReplaySubScript.h"
#include "../IFloatingWindowScript.h"
#include <string>
diff --git a/game/menus/mainmenu/CreditsSubScene.cpp b/game/menus/mainmenu/CreditsSubScene.cpp
new file mode 100644
index 0000000..65576ee
--- /dev/null
+++ b/game/menus/mainmenu/CreditsSubScene.cpp
@@ -0,0 +1,132 @@
+
+#include "CreditsSubScene.h"
+#include "CreditsSubScript.h"
+
+#include "../../Config.h"
+#include "../ButtonSubScene.h"
+#include "../FloatingWindowSubScene.h"
+
+#include <string>
+
+#include <crepe/api/BehaviorScript.h>
+#include <crepe/api/GameObject.h>
+#include <crepe/api/Text.h>
+#include <crepe/types.h>
+
+using namespace crepe;
+using namespace std;
+
+void CreditsSubScene::create(Scene & scn) {
+
+ const std::string TAG = "credits_tag";
+ GameObject script = scn.new_object("script");
+ script.add_component<BehaviorScript>().set_script<CreditsSubScript>(TAG);
+
+ // Window
+ FloatingWindowSubScene window;
+ window.create(
+ scn,
+ FloatingWindowSubScene::Data {
+ .group_tag = TAG,
+ .width = 500,
+ .offset = {150, -50},
+ .width_middle_offset = -2,
+ }
+ );
+
+ // Titel
+ const string TITEL_STRING = "Credits";
+ GameObject titel = scn.new_object("titel", TAG);
+ crepe::vec2 size = {200, (200.0f / TITEL_STRING.size()) * 2};
+ titel.add_component<Text>(
+ size, FONT,
+ Text::Data {
+ .world_space = false,
+ .text_color = Color::WHITE,
+ },
+ vec2 {150, -207} + FONTOFFSET, TITEL_STRING
+ );
+
+ // Buttons
+ vec2 button_position = {190, 190};
+ ButtonSubScene button;
+ button.create(
+ scn,
+ ButtonSubScene::Data {
+ .text = "Back",
+ .text_width = 150,
+ .position = {-button_position.x + 150, button_position.y},
+ .script_type = ButtonSubScene::ScriptSelect::CREDITS_BACK,
+ .button_type = ButtonSubScene::ButtonSelect::BACK,
+ .scale = 0.6,
+ .worldspace = false,
+ .tag = TAG,
+ .sorting_layer_offset = 20,
+ }
+ );
+
+ const float SIZE_CHAR_NAMES = 10;
+ const float Y_OFFSET_NAMES_BEGIN = 100;
+ const float Y_OFFSET_NAMES = 30;
+ const string LOEK = "Loek Le Blansch";
+ crepe::vec2 size_loek
+ = {LOEK.size() * SIZE_CHAR_NAMES, (LOEK.size() * SIZE_CHAR_NAMES / LOEK.size()) * 2};
+ titel.add_component<Text>(
+ size_loek, FONT,
+ Text::Data {
+ .world_space = false,
+ .text_color = Color::WHITE,
+ },
+ vec2 {150, -207 + Y_OFFSET_NAMES + Y_OFFSET_NAMES_BEGIN} + FONTOFFSET, LOEK
+ );
+
+ const string WOUTER = "Wouter Boerenkamps";
+ crepe::vec2 size_wouter
+ = {WOUTER.size() * SIZE_CHAR_NAMES,
+ (WOUTER.size() * SIZE_CHAR_NAMES / WOUTER.size()) * 2};
+ titel.add_component<Text>(
+ size_wouter, FONT,
+ Text::Data {
+ .world_space = false,
+ .text_color = Color::WHITE,
+ },
+ vec2 {150, -207 + Y_OFFSET_NAMES * 2 + Y_OFFSET_NAMES_BEGIN} + FONTOFFSET, WOUTER
+ );
+
+ const string JARO = "Jaro Rutjes";
+ crepe::vec2 size_jaro
+ = {JARO.size() * SIZE_CHAR_NAMES, (JARO.size() * SIZE_CHAR_NAMES / JARO.size()) * 2};
+ titel.add_component<Text>(
+ size_jaro, FONT,
+ Text::Data {
+ .world_space = false,
+ .text_color = Color::WHITE,
+ },
+ vec2 {150, -207 + Y_OFFSET_NAMES * 3 + Y_OFFSET_NAMES_BEGIN} + FONTOFFSET, JARO
+ );
+
+ const string MAX = "Max Smits";
+ crepe::vec2 size_max
+ = {MAX.size() * SIZE_CHAR_NAMES, (MAX.size() * SIZE_CHAR_NAMES / MAX.size()) * 2};
+ titel.add_component<Text>(
+ size_max, FONT,
+ Text::Data {
+ .world_space = false,
+ .text_color = Color::WHITE,
+ },
+ vec2 {150, -207 + Y_OFFSET_NAMES * 4 + Y_OFFSET_NAMES_BEGIN} + FONTOFFSET, MAX
+ );
+
+ const string NIELS = "Niels Stunnebrink";
+ crepe::vec2 size_niels
+ = {NIELS.size() * SIZE_CHAR_NAMES, (NIELS.size() * SIZE_CHAR_NAMES / NIELS.size()) * 2
+ };
+ titel.add_component<Text>(
+ size_niels, FONT,
+ Text::Data {
+ .world_space = false,
+ .text_color = Color::WHITE,
+ },
+ vec2 {150, -207 + Y_OFFSET_NAMES * 5 + Y_OFFSET_NAMES_BEGIN} + FONTOFFSET, NIELS
+ );
+}
diff --git a/game/menus/mainmenu/CreditsSubScene.h b/game/menus/mainmenu/CreditsSubScene.h
new file mode 100644
index 0000000..e7ff735
--- /dev/null
+++ b/game/menus/mainmenu/CreditsSubScene.h
@@ -0,0 +1,9 @@
+#pragma once
+
+#include <crepe/api/Scene.h>
+
+class CreditsSubScene {
+
+public:
+ void create(crepe::Scene & scn);
+};
diff --git a/game/menus/mainmenu/CreditsSubScript.cpp b/game/menus/mainmenu/CreditsSubScript.cpp
new file mode 100644
index 0000000..4224dc8
--- /dev/null
+++ b/game/menus/mainmenu/CreditsSubScript.cpp
@@ -0,0 +1,58 @@
+#include "CreditsSubScript.h"
+
+#include "../../Events.h"
+#include "../ButtonReplaySubScript.h"
+#include "../IFloatingWindowScript.h"
+
+#include <string>
+
+#include <crepe/api/Button.h>
+#include <crepe/api/Sprite.h>
+#include <crepe/api/Text.h>
+#include <crepe/types.h>
+
+using namespace crepe;
+
+CreditsSubScript::CreditsSubScript(const std::string & tag) { this->tag = tag; }
+
+void CreditsSubScript::init() {
+ IButtonScript::init();
+ this->subscribe<ButtonPressEvent>([this](const ButtonPressEvent & e) {
+ return this->on_button_press(e);
+ });
+ this->subscribe<ShowCreditsEvent>([this](const ShowCreditsEvent & e) {
+ this->enable_all();
+ return false;
+ });
+ this->disable_all();
+}
+
+bool CreditsSubScript::disable_all() {
+ IFloatingWindowScript::disable_all_sprites();
+ RefVector<Button> buttons = this->get_components_by_tag<Button>(this->tag);
+ for (Button & button : buttons) {
+ button.active = false;
+ }
+ RefVector<Text> texts = this->get_components_by_tag<Text>(this->tag);
+ for (Text & text : texts) {
+ text.active = false;
+ }
+ return false;
+}
+
+bool CreditsSubScript::enable_all() {
+ IFloatingWindowScript::enable_all_sprites();
+ RefVector<Button> buttons = this->get_components_by_tag<Button>(this->tag);
+ for (Button & button : buttons) {
+ button.active = true;
+ }
+ RefVector<Text> texts = this->get_components_by_tag<Text>(this->tag);
+ for (Text & text : texts) {
+ text.active = true;
+ }
+ return false;
+}
+
+bool CreditsSubScript::on_button_press(const ButtonPressEvent & e) {
+ return this->disable_all();
+}
diff --git a/game/menus/mainmenu/CreditsSubScript.h b/game/menus/mainmenu/CreditsSubScript.h
new file mode 100644
index 0000000..81f941a
--- /dev/null
+++ b/game/menus/mainmenu/CreditsSubScript.h
@@ -0,0 +1,18 @@
+#pragma once
+
+#include "../IButtonScript.h"
+#include "../IFloatingWindowScript.h"
+
+#include <crepe/api/Event.h>
+#include <crepe/api/Script.h>
+
+struct ShowCreditsEvent : public crepe::Event {};
+
+class CreditsSubScript : public IFloatingWindowScript, public IButtonScript {
+public:
+ CreditsSubScript(const std::string & tag);
+ void init() override;
+ bool disable_all();
+ bool enable_all();
+ bool on_button_press(const crepe::ButtonPressEvent & e);
+};
diff --git a/game/menus/mainmenu/MainMenuScene.cpp b/game/menus/mainmenu/MainMenuScene.cpp
index 43418e3..fba90ac 100644
--- a/game/menus/mainmenu/MainMenuScene.cpp
+++ b/game/menus/mainmenu/MainMenuScene.cpp
@@ -1,5 +1,6 @@
#include "MainMenuScene.h"
+#include "CreditsSubScene.h"
#include "MainMenuConfig.h"
#include "TransitionStartSubScript.h"
@@ -64,7 +65,7 @@ void MainMenuScene::load_scene() {
ButtonSubScene::Data {
.text = "SHOP",
.text_offset = {-20, 0},
- .text_width = 115,
+ .text_width = 110,
.icon_offset = {60, 0},
.icon_type = ButtonSubScene::IconSelect::SHOP,
.position = pos_btn,
@@ -72,6 +73,19 @@ void MainMenuScene::load_scene() {
}
);
+ //Credits btn
+ pos_btn.y += MENU_BUTTON_SPACING + LARGE_OVERLAY_SIZE.y;
+ button.create(
+ *this,
+ ButtonSubScene::Data {
+ .text = "CREDITS",
+ .text_offset = {0, 0},
+ .text_width = 200,
+ .position = pos_btn,
+ .script_type = ButtonSubScene::ScriptSelect::CREDITS_SHOW,
+ }
+ );
+
//Start of map
StartSubScene start;
HallwaySubScene hallway;
@@ -110,6 +124,9 @@ void MainMenuScene::load_scene() {
.tag = MENU_INFO_TAG,
}
);
+
+ CreditsSubScene creditscene;
+ creditscene.create(*this);
}
string MainMenuScene::get_name() const { return MAINMENU_SCENE; }
diff --git a/game/menus/shop/ShopMenuScene.cpp b/game/menus/shop/ShopMenuScene.cpp
index d4542ba..d1ea81d 100644
--- a/game/menus/shop/ShopMenuScene.cpp
+++ b/game/menus/shop/ShopMenuScene.cpp
@@ -5,9 +5,11 @@
#include "../BannerSubScene.h"
#include "../ButtonSubScene.h"
#include "../MenusConfig.h"
+#include "types.h"
#include <crepe/api/Camera.h>
#include <crepe/api/Sprite.h>
+#include <crepe/api/Text.h>
using namespace crepe;
using namespace std;
@@ -51,6 +53,74 @@ void ShopMenuScene::load_scene() {
.scale = 0.8
}
);
+
+ GameObject shop_item_bullet = this->new_object("bullet", "shop_item", vec2(-100, 0));
+ shop_item_bullet.add_component<Sprite>(
+ Asset("asset/other_effects/effect_rocketmgshell_TVOS.png"),
+ Sprite::Data {
+ .sorting_in_layer = STARTING_SORTING_IN_LAYER + 1,
+ .size = {0, 100},
+ .position_offset = {0, 0},
+ }
+ );
+ shop_item_bullet.add_component<Text>(
+ vec2 {100, 50}, FONT,
+ Text::Data {
+ .world_space = true,
+ .text_color = Color::WHITE,
+ },
+ vec2 {0, -75}, "BULLETS"
+ );
+ shop_item_bullet.add_component<Sprite>(
+ Asset("asset/ui/buttonCoinsSmall.png"),
+ Sprite::Data {
+ .sorting_in_layer = STARTING_SORTING_IN_LAYER + 1,
+ .size = {0, 45},
+ .position_offset = {25, 75},
+ }
+ );
+ shop_item_bullet.add_component<Text>(
+ vec2 {37.5, 37.5}, FONT,
+ Text::Data {
+ .world_space = true,
+ .text_color = Color::GOLD,
+ },
+ vec2 {-25, 75}, "0"
+ );
+
+ GameObject shop_item_bubble = this->new_object("bubble", "shop_item", vec2(100, 0));
+ shop_item_bubble.add_component<Sprite>(
+ Asset("asset/background/aquarium/bubble.png"),
+ Sprite::Data {
+ .sorting_in_layer = STARTING_SORTING_IN_LAYER + 1,
+ .size = {0, 100},
+ .position_offset = {0, 0},
+ }
+ );
+ shop_item_bubble.add_component<Text>(
+ vec2 {100, 50}, FONT,
+ Text::Data {
+ .world_space = true,
+ .text_color = Color::WHITE,
+ },
+ vec2 {0, -75}, "BUBBLE"
+ );
+ shop_item_bubble.add_component<Sprite>(
+ Asset("asset/ui/buttonCoinsSmall.png"),
+ Sprite::Data {
+ .sorting_in_layer = STARTING_SORTING_IN_LAYER + 1,
+ .size = {0, 45},
+ .position_offset = {45, 75},
+ }
+ );
+ shop_item_bubble.add_component<Text>(
+ vec2 {100, 25}, FONT,
+ Text::Data {
+ .world_space = true,
+ .text_color = Color::GOLD,
+ },
+ vec2 {-25, 75}, "1000"
+ );
}
string ShopMenuScene::get_name() const { return SHOP_SCENE; }
diff --git a/game/player/PlayerEndScript.cpp b/game/player/PlayerEndScript.cpp
index fb18f2f..047dbb0 100644
--- a/game/player/PlayerEndScript.cpp
+++ b/game/player/PlayerEndScript.cpp
@@ -90,7 +90,7 @@ bool PlayerEndScript::on_collision(const crepe::CollisionEvent & ev) {
jump++;
}
- if (rb_player.data.linear_velocity.x < 5) {
+ if (rb_player.data.linear_velocity.x < 5 && jump >= 3) {
this->trigger_event<EndGameEvent>();
}