aboutsummaryrefslogtreecommitdiff
path: root/game/background/StartSubScene.cpp
diff options
context:
space:
mode:
authorMax-001 <maxsmits21@kpnmail.nl>2024-12-21 11:36:37 +0100
committerMax-001 <maxsmits21@kpnmail.nl>2024-12-21 11:36:37 +0100
commitd2af158ac63ab05b2fbfdcdf1b483662e48c0544 (patch)
tree14edc04fe7ddb4b85b151dfb857557fded5b2b93 /game/background/StartSubScene.cpp
parent9da9dd5a1ceb877dd6d822e91b3be2ffd4b43160 (diff)
Added Config.h
Diffstat (limited to 'game/background/StartSubScene.cpp')
-rw-r--r--game/background/StartSubScene.cpp228
1 files changed, 117 insertions, 111 deletions
diff --git a/game/background/StartSubScene.cpp b/game/background/StartSubScene.cpp
index 5d810c2..547b00d 100644
--- a/game/background/StartSubScene.cpp
+++ b/game/background/StartSubScene.cpp
@@ -1,5 +1,7 @@
#include "StartSubScene.h"
+#include "../Config.h"
+
#include <crepe/api/Animator.h>
#include <crepe/api/CircleCollider.h>
#include <crepe/api/Color.h>
@@ -18,17 +20,18 @@ float StartSubScene::create(Scene & scn, float begin_x) {
GameObject begin = scn.new_object("start_begin", "background", vec2(begin_x, 0));
Asset begin_asset{"asset/background/start/titleFG_1_TVOS.png"};
begin.add_component<Sprite>(begin_asset, Sprite::Data{
- .sorting_in_layer = 4,
+ .sorting_in_layer = SORT_IN_LAY_BACKGROUND,
.order_in_layer = 0,
.size = vec2(0, 800),
});
GameObject hole = scn.new_object("start_hole", "background", vec2(begin_x - 250, 140));
Asset hole_asset{"asset/background/start/titleWallHole.png"};
- Sprite & hole_sprite = hole.add_component<Sprite>(hole_asset, Sprite::Data{
- .sorting_in_layer = 4,
- .order_in_layer = 1,
- .size = vec2(0, 200),
- });
+ Sprite & hole_sprite = hole.add_component<Sprite>(
+ hole_asset, Sprite::Data{
+ .sorting_in_layer = SORT_IN_LAY_BACKGROUND,
+ .order_in_layer = 1,
+ .size = vec2(0, 200),
+ });
hole_sprite.active = false;
begin_x += 700;
@@ -39,7 +42,7 @@ float StartSubScene::create(Scene & scn, float begin_x) {
GameObject end = scn.new_object("start_end", "background", vec2(begin_x, 0));
Asset end_asset{"asset/background/start/titleFG_2_TVOS.png"};
end.add_component<Sprite>(end_asset, Sprite::Data{
- .sorting_in_layer = 4,
+ .sorting_in_layer = SORT_IN_LAY_BACKGROUND,
.order_in_layer = 1,
.size = vec2(0, 800),
});
@@ -53,7 +56,7 @@ float StartSubScene::create(Scene & scn, float begin_x) {
void StartSubScene::add_lamp(GameObject & obj, vec2 offset, unsigned int fps) {
Asset lamp_asset{"asset/background/start/alarmLight_TVOS.png"};
obj.add_component<Sprite>(lamp_asset, Sprite::Data{
- .sorting_in_layer = 5,
+ .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND,
.order_in_layer = 0,
.size = vec2(0, 100),
.position_offset = offset,
@@ -61,7 +64,7 @@ void StartSubScene::add_lamp(GameObject & obj, vec2 offset, unsigned int fps) {
Asset lamp_glow_asset{"asset/background/start/alarmGlow_TVOS.png"};
Sprite & lamp_glow_sprite = obj.add_component<Sprite>(
lamp_glow_asset, Sprite::Data{
- .sorting_in_layer = 5,
+ .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND,
.order_in_layer = 1,
.size = vec2(0, 300),
.position_offset = offset - vec2(65, -55),
@@ -77,7 +80,7 @@ void StartSubScene::add_lamp(GameObject & obj, vec2 offset, unsigned int fps) {
void StartSubScene::add_table(GameObject & obj, vec2 offset) {
Asset table_asset{"asset/background/start/table.png"};
obj.add_component<Sprite>(table_asset, Sprite::Data{
- .sorting_in_layer = 5,
+ .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND,
.order_in_layer = 0,
.size = vec2(0, 100),
.position_offset = offset,
@@ -85,7 +88,7 @@ void StartSubScene::add_table(GameObject & obj, vec2 offset) {
Asset gramophone_asset{"asset/background/start/gramophone_TVOS.png"};
Sprite & gramophone_sprite = obj.add_component<Sprite>(
gramophone_asset, Sprite::Data{
- .sorting_in_layer = 5,
+ .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND,
.order_in_layer = 1,
.size = vec2(0, 100),
.position_offset = offset + vec2(0, -50),
@@ -100,36 +103,38 @@ void StartSubScene::add_table(GameObject & obj, vec2 offset) {
void StartSubScene::add_light(crepe::GameObject & obj, crepe::vec2 offset) {
Asset light_asset{"asset/background/start/title_light_TVOS.png"};
obj.add_component<Sprite>(light_asset, Sprite::Data{
- .sorting_in_layer = 5,
+ .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND,
.order_in_layer = 0,
.size = vec2(0, 200),
.position_offset = offset,
});
Asset light_glow_asset{"asset/background/start/lightEffect2.png"};
- obj.add_component<Sprite>(light_glow_asset, Sprite::Data{
- .sorting_in_layer = 5,
- .order_in_layer = 1,
- .size = vec2(0, 100),
- .position_offset = offset + vec2(0, 75),
- });
+ obj.add_component<Sprite>(light_glow_asset,
+ Sprite::Data{
+ .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND,
+ .order_in_layer = 1,
+ .size = vec2(0, 100),
+ .position_offset = offset + vec2(0, 75),
+ });
Asset light_effect_asset{"asset/background/start/lightEffect.png"};
- obj.add_component<Sprite>(light_effect_asset, Sprite::Data{
- .sorting_in_layer = 5,
- .order_in_layer = 0,
- .size = vec2(0, 100),
- .position_offset = offset + vec2(0, 350),
- });
+ obj.add_component<Sprite>(light_effect_asset,
+ Sprite::Data{
+ .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND,
+ .order_in_layer = 0,
+ .size = vec2(0, 100),
+ .position_offset = offset + vec2(0, 350),
+ });
}
void StartSubScene::add_jetpack_stand(crepe::GameObject & obj, crepe::vec2 offset) {
Asset jetpack_stand_asset{"asset/background/start/JetpackStand.png"};
- Sprite & jetpeck_stand_sprite
- = obj.add_component<Sprite>(jetpack_stand_asset, Sprite::Data{
- .sorting_in_layer = 5,
- .order_in_layer = 1,
- .size = vec2(0, 70),
- .position_offset = offset,
- });
+ Sprite & jetpeck_stand_sprite = obj.add_component<Sprite>(
+ jetpack_stand_asset, Sprite::Data{
+ .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND,
+ .order_in_layer = 1,
+ .size = vec2(0, 70),
+ .position_offset = offset,
+ });
obj.add_component<Animator>(jetpeck_stand_sprite, ivec2(34, 46), uvec2(2, 1),
Animator::Data{
.fps = 10,
@@ -137,23 +142,24 @@ void StartSubScene::add_jetpack_stand(crepe::GameObject & obj, crepe::vec2 offse
})
.pause();
Asset do_not_steal = {"asset/background/start/doNotTouchSign_TVOS.png"};
- obj.add_component<Sprite>(do_not_steal, Sprite::Data{
- .sorting_in_layer = 5,
- .order_in_layer = 1,
- .size = vec2(0, 100),
- .position_offset = offset + vec2(-75, -25),
- });
+ obj.add_component<Sprite>(do_not_steal,
+ Sprite::Data{
+ .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND,
+ .order_in_layer = 1,
+ .size = vec2(0, 100),
+ .position_offset = offset + vec2(-75, -25),
+ });
}
void StartSubScene::create_wall_fragments(crepe::Scene & scn, float begin_x) {
GameObject frag_1 = scn.new_object("frag_1", "wall_fragment", vec2(begin_x, 200));
Asset frag_1_asset{"asset/background/start/StartWall_frag1.png"};
- Sprite & frag_1_sprite
- = frag_1.add_component<Sprite>(frag_1_asset, Sprite::Data{
- .sorting_in_layer = 5,
- .order_in_layer = 5,
- .size = vec2(0, 50),
- });
+ Sprite & frag_1_sprite = frag_1.add_component<Sprite>(
+ frag_1_asset, Sprite::Data{
+ .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND,
+ .order_in_layer = 5,
+ .size = vec2(0, 50),
+ });
frag_1_sprite.active = false;
Rigidbody & frag_1_rb = frag_1.add_component<Rigidbody>(Rigidbody::Data{
.gravity_scale = 10,
@@ -169,12 +175,12 @@ void StartSubScene::create_wall_fragments(crepe::Scene & scn, float begin_x) {
GameObject frag_2 = scn.new_object("frag_2", "wall_fragment", vec2(begin_x, 180));
Asset frag_2_asset{"asset/background/start/StartWall_frag2.png"};
- Sprite & frag_2_sprite
- = frag_2.add_component<Sprite>(frag_2_asset, Sprite::Data{
- .sorting_in_layer = 5,
- .order_in_layer = 5,
- .size = vec2(0, 50),
- });
+ Sprite & frag_2_sprite = frag_2.add_component<Sprite>(
+ frag_2_asset, Sprite::Data{
+ .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND,
+ .order_in_layer = 5,
+ .size = vec2(0, 50),
+ });
frag_2_sprite.active = false;
Rigidbody & frag_2_rb = frag_2.add_component<Rigidbody>(Rigidbody::Data{
.gravity_scale = 20,
@@ -190,12 +196,12 @@ void StartSubScene::create_wall_fragments(crepe::Scene & scn, float begin_x) {
GameObject frag_3 = scn.new_object("frag_3", "wall_fragment", vec2(begin_x, 170));
Asset frag_3_asset{"asset/background/start/StartWall_frag3.png"};
- Sprite & frag_3_sprite
- = frag_3.add_component<Sprite>(frag_3_asset, Sprite::Data{
- .sorting_in_layer = 5,
- .order_in_layer = 5,
- .size = vec2(0, 50),
- });
+ Sprite & frag_3_sprite = frag_3.add_component<Sprite>(
+ frag_3_asset, Sprite::Data{
+ .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND,
+ .order_in_layer = 5,
+ .size = vec2(0, 50),
+ });
frag_3_sprite.active = false;
Rigidbody & frag_3_rb = frag_3.add_component<Rigidbody>(Rigidbody::Data{
.gravity_scale = 30,
@@ -211,12 +217,12 @@ void StartSubScene::create_wall_fragments(crepe::Scene & scn, float begin_x) {
GameObject frag_4 = scn.new_object("frag_4", "wall_fragment", vec2(begin_x, 160));
Asset frag_4_asset{"asset/background/start/StartWall_frag4.png"};
- Sprite & frag_4_sprite
- = frag_4.add_component<Sprite>(frag_4_asset, Sprite::Data{
- .sorting_in_layer = 5,
- .order_in_layer = 5,
- .size = vec2(0, 50),
- });
+ Sprite & frag_4_sprite = frag_4.add_component<Sprite>(
+ frag_4_asset, Sprite::Data{
+ .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND,
+ .order_in_layer = 5,
+ .size = vec2(0, 50),
+ });
frag_4_sprite.active = false;
Rigidbody & frag_4_rb = frag_4.add_component<Rigidbody>(Rigidbody::Data{
.gravity_scale = 40,
@@ -232,12 +238,12 @@ void StartSubScene::create_wall_fragments(crepe::Scene & scn, float begin_x) {
GameObject frag_5 = scn.new_object("frag_5", "wall_fragment", vec2(begin_x, 150));
Asset frag_5_asset{"asset/background/start/StartWall_frag5.png"};
- Sprite & frag_5_sprite
- = frag_5.add_component<Sprite>(frag_5_asset, Sprite::Data{
- .sorting_in_layer = 5,
- .order_in_layer = 5,
- .size = vec2(0, 50),
- });
+ Sprite & frag_5_sprite = frag_5.add_component<Sprite>(
+ frag_5_asset, Sprite::Data{
+ .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND,
+ .order_in_layer = 5,
+ .size = vec2(0, 50),
+ });
frag_5_sprite.active = false;
Rigidbody & frag_5_rb = frag_5.add_component<Rigidbody>(Rigidbody::Data{
.gravity_scale = 50,
@@ -253,12 +259,12 @@ void StartSubScene::create_wall_fragments(crepe::Scene & scn, float begin_x) {
GameObject frag_6 = scn.new_object("frag_6", "wall_fragment", vec2(begin_x, 140));
Asset frag_6_asset{"asset/background/start/StartWall_frag6.png"};
- Sprite & frag_6_sprite
- = frag_6.add_component<Sprite>(frag_6_asset, Sprite::Data{
- .sorting_in_layer = 5,
- .order_in_layer = 5,
- .size = vec2(0, 50),
- });
+ Sprite & frag_6_sprite = frag_6.add_component<Sprite>(
+ frag_6_asset, Sprite::Data{
+ .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND,
+ .order_in_layer = 5,
+ .size = vec2(0, 50),
+ });
frag_6_sprite.active = false;
Rigidbody & frag_6_rb = frag_6.add_component<Rigidbody>(Rigidbody::Data{
.gravity_scale = 30,
@@ -274,12 +280,12 @@ void StartSubScene::create_wall_fragments(crepe::Scene & scn, float begin_x) {
GameObject frag_7 = scn.new_object("frag_7", "wall_fragment", vec2(begin_x, 130));
Asset frag_7_asset{"asset/background/start/StartWall_frag7.png"};
- Sprite & frag_7_sprite
- = frag_7.add_component<Sprite>(frag_7_asset, Sprite::Data{
- .sorting_in_layer = 5,
- .order_in_layer = 5,
- .size = vec2(0, 50),
- });
+ Sprite & frag_7_sprite = frag_7.add_component<Sprite>(
+ frag_7_asset, Sprite::Data{
+ .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND,
+ .order_in_layer = 5,
+ .size = vec2(0, 50),
+ });
frag_7_sprite.active = false;
Rigidbody & frag_7_rb = frag_7.add_component<Rigidbody>(Rigidbody::Data{
.gravity_scale = 20,
@@ -295,12 +301,12 @@ void StartSubScene::create_wall_fragments(crepe::Scene & scn, float begin_x) {
GameObject frag_8 = scn.new_object("frag_8", "wall_fragment", vec2(begin_x, 120));
Asset frag_8_asset{"asset/background/start/StartWall_frag8.png"};
- Sprite & frag_8_sprite
- = frag_8.add_component<Sprite>(frag_8_asset, Sprite::Data{
- .sorting_in_layer = 5,
- .order_in_layer = 5,
- .size = vec2(0, 50),
- });
+ Sprite & frag_8_sprite = frag_8.add_component<Sprite>(
+ frag_8_asset, Sprite::Data{
+ .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND,
+ .order_in_layer = 5,
+ .size = vec2(0, 50),
+ });
frag_8_sprite.active = false;
Rigidbody & frag_8_rb = frag_8.add_component<Rigidbody>(Rigidbody::Data{
.gravity_scale = 30,
@@ -316,12 +322,12 @@ void StartSubScene::create_wall_fragments(crepe::Scene & scn, float begin_x) {
GameObject frag_9 = scn.new_object("frag_9", "wall_fragment", vec2(begin_x, 110));
Asset frag_9_asset{"asset/background/start/StartWall_frag9.png"};
- Sprite & frag_9_sprite
- = frag_9.add_component<Sprite>(frag_9_asset, Sprite::Data{
- .sorting_in_layer = 5,
- .order_in_layer = 5,
- .size = vec2(0, 50),
- });
+ Sprite & frag_9_sprite = frag_9.add_component<Sprite>(
+ frag_9_asset, Sprite::Data{
+ .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND,
+ .order_in_layer = 5,
+ .size = vec2(0, 50),
+ });
frag_9_sprite.active = false;
Rigidbody & frag_9_rb = frag_9.add_component<Rigidbody>(Rigidbody::Data{
.gravity_scale = 40,
@@ -337,12 +343,12 @@ void StartSubScene::create_wall_fragments(crepe::Scene & scn, float begin_x) {
GameObject frag_10 = scn.new_object("frag_10", "wall_fragment", vec2(begin_x, 100));
Asset frag_10_asset{"asset/background/start/StartWall_frag10.png"};
- Sprite & frag_10_sprite
- = frag_10.add_component<Sprite>(frag_10_asset, Sprite::Data{
- .sorting_in_layer = 5,
- .order_in_layer = 5,
- .size = vec2(0, 50),
- });
+ Sprite & frag_10_sprite = frag_10.add_component<Sprite>(
+ frag_10_asset, Sprite::Data{
+ .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND,
+ .order_in_layer = 5,
+ .size = vec2(0, 50),
+ });
frag_10_sprite.active = false;
Rigidbody & frag_10_rb = frag_10.add_component<Rigidbody>(Rigidbody::Data{
.gravity_scale = 50,
@@ -358,12 +364,12 @@ void StartSubScene::create_wall_fragments(crepe::Scene & scn, float begin_x) {
GameObject frag_11 = scn.new_object("frag_11", "wall_fragment", vec2(begin_x, 90));
Asset frag_11_asset{"asset/background/start/StartWall_frag11.png"};
- Sprite & frag_11_sprite
- = frag_11.add_component<Sprite>(frag_11_asset, Sprite::Data{
- .sorting_in_layer = 5,
- .order_in_layer = 5,
- .size = vec2(0, 50),
- });
+ Sprite & frag_11_sprite = frag_11.add_component<Sprite>(
+ frag_11_asset, Sprite::Data{
+ .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND,
+ .order_in_layer = 5,
+ .size = vec2(0, 50),
+ });
frag_11_sprite.active = false;
Rigidbody & frag_11_rb = frag_11.add_component<Rigidbody>(Rigidbody::Data{
.gravity_scale = 60,
@@ -379,12 +385,12 @@ void StartSubScene::create_wall_fragments(crepe::Scene & scn, float begin_x) {
GameObject frag_12 = scn.new_object("frag_12", "wall_fragment", vec2(begin_x, 80));
Asset frag_12_asset{"asset/background/start/StartWall_frag12.png"};
- Sprite & frag_12_sprite
- = frag_12.add_component<Sprite>(frag_12_asset, Sprite::Data{
- .sorting_in_layer = 5,
- .order_in_layer = 5,
- .size = vec2(0, 50),
- });
+ Sprite & frag_12_sprite = frag_12.add_component<Sprite>(
+ frag_12_asset, Sprite::Data{
+ .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND,
+ .order_in_layer = 5,
+ .size = vec2(0, 50),
+ });
frag_12_sprite.active = false;
Rigidbody & frag_12_rb = frag_12.add_component<Rigidbody>(Rigidbody::Data{
.gravity_scale = 70,
@@ -404,7 +410,7 @@ void StartSubScene::create_wall_fragments(crepe::Scene & scn, float begin_x) {
Sprite & smoke_sprite_1 = smoke_particles_1.add_component<Sprite>(
smoke_asset_1, Sprite::Data{
.color = Color(255, 255, 255, 50),
- .sorting_in_layer = 15,
+ .sorting_in_layer = SORT_IN_LAY_PARTICLES_FOREGROUND,
.order_in_layer = 0,
.size = vec2(0, 100),
});
@@ -425,7 +431,7 @@ void StartSubScene::create_wall_fragments(crepe::Scene & scn, float begin_x) {
Sprite & smoke_sprite_2 = smoke_particles_2.add_component<Sprite>(
smoke_asset_2, Sprite::Data{
.color = Color(255, 255, 255, 50),
- .sorting_in_layer = 15,
+ .sorting_in_layer = SORT_IN_LAY_PARTICLES_FOREGROUND,
.order_in_layer = 0,
.size = vec2(0, 70),
});