aboutsummaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
authorMax-001 <80035972+Max-001@users.noreply.github.com>2025-01-08 15:28:25 +0100
committerGitHub <noreply@github.com>2025-01-08 15:28:25 +0100
commit52dab49823377e9ffaf7b583edc102b559e7382a (patch)
treed966a39f23ac053c6cc5cee678d55c28f795704f /game
parent0b9574bdd6c5968c07bcf165d66032b75649b5da (diff)
parente732abef5d0170cacf290de12a402dbd19f31a87 (diff)
Merge pull request #114 from lonkaars/max/game2
Max/game2
Diffstat (limited to 'game')
-rw-r--r--game/Config.h3
-rw-r--r--game/hud/HudSubScene.cpp2
-rw-r--r--game/menus/shop/ShopMenuScene.cpp71
-rw-r--r--game/player/PlayerEndScript.cpp2
4 files changed, 76 insertions, 2 deletions
diff --git a/game/Config.h b/game/Config.h
index f1b64b3..c2f95c0 100644
--- a/game/Config.h
+++ b/game/Config.h
@@ -45,3 +45,6 @@ static constexpr const char * DISTANCE_RUN = "distance_run";
static constexpr const char * PLAYER_NAME = "player";
static constexpr int PLAYER_SPEED = 7500; // In game units
static constexpr int PLAYER_GRAVITY_SCALE = 60; // In game units
+
+// 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/menus/shop/ShopMenuScene.cpp b/game/menus/shop/ShopMenuScene.cpp
index 21e3f02..d1ea81d 100644
--- a/game/menus/shop/ShopMenuScene.cpp
+++ b/game/menus/shop/ShopMenuScene.cpp
@@ -1,12 +1,15 @@
#include "ShopMenuScene.h"
+#include "../../Config.h"
#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;
@@ -50,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>();
}