diff options
Diffstat (limited to 'game/background')
-rw-r--r-- | game/background/AquariumSubScene.cpp | 204 | ||||
-rw-r--r-- | game/background/ForestParallaxScript.cpp | 5 | ||||
-rw-r--r-- | game/background/ForestSubScene.cpp | 194 | ||||
-rw-r--r-- | game/background/HallwaySubScene.cpp | 190 | ||||
-rw-r--r-- | game/background/HallwaySubScene.h | 11 | ||||
-rw-r--r-- | game/background/StartSubScene.cpp | 491 |
6 files changed, 622 insertions, 473 deletions
diff --git a/game/background/AquariumSubScene.cpp b/game/background/AquariumSubScene.cpp index 579e633..8d5202a 100644 --- a/game/background/AquariumSubScene.cpp +++ b/game/background/AquariumSubScene.cpp @@ -16,73 +16,85 @@ float AquariumSubScene::create(Scene & scn, float begin_x) { GameObject aquarium_begin = scn.new_object("aquarium_begin", "background", vec2(begin_x, 0)); - Asset aquarium_begin_asset{"asset/background/aquarium/glassTubeFG_1_TVOS.png"}; - aquarium_begin.add_component<Sprite>(aquarium_begin_asset, - Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_BACKGROUND, - .order_in_layer = 0, - .size = vec2(0, GAME_HEIGHT), - }); + Asset aquarium_begin_asset {"asset/background/aquarium/glassTubeFG_1_TVOS.png"}; + aquarium_begin.add_component<Sprite>( + aquarium_begin_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACKGROUND, + .order_in_layer = 0, + .size = vec2(0, GAME_HEIGHT), + } + ); begin_x += 600; GameObject aquarium_middle_1 = scn.new_object("aquarium_middle", "background", vec2(begin_x, 0)); - Asset aquarium_middle_1_asset{"asset/background/aquarium/glassTubeFG_3_TVOS.png"}; - aquarium_middle_1.add_component<Sprite>(aquarium_middle_1_asset, - Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_BACKGROUND, - .order_in_layer = 2, - .size = vec2(0, GAME_HEIGHT), - }); + Asset aquarium_middle_1_asset {"asset/background/aquarium/glassTubeFG_3_TVOS.png"}; + aquarium_middle_1.add_component<Sprite>( + aquarium_middle_1_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACKGROUND, + .order_in_layer = 2, + .size = vec2(0, GAME_HEIGHT), + } + ); begin_x += 400; this->add_background(scn, begin_x - 200); GameObject aquarium_middle_2 = scn.new_object("aquarium_middle", "background", vec2(begin_x, 0)); - Asset aquarium_middle_2_asset{"asset/background/aquarium/glassTubeFG_3_TVOS.png"}; - aquarium_middle_2.add_component<Sprite>(aquarium_middle_2_asset, - Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_BACKGROUND, - .order_in_layer = 3, - .size = vec2(0, GAME_HEIGHT), - }); + Asset aquarium_middle_2_asset {"asset/background/aquarium/glassTubeFG_3_TVOS.png"}; + aquarium_middle_2.add_component<Sprite>( + aquarium_middle_2_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACKGROUND, + .order_in_layer = 3, + .size = vec2(0, GAME_HEIGHT), + } + ); begin_x += 400; GameObject aquarium_middle_3 = scn.new_object("aquarium_middle", "background", vec2(begin_x, 0)); - Asset aquarium_middle_3_asset{"asset/background/aquarium/glassTubeFG_3_TVOS.png"}; - aquarium_middle_3.add_component<Sprite>(aquarium_middle_3_asset, - Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_BACKGROUND, - .order_in_layer = 4, - .size = vec2(0, GAME_HEIGHT), - }); + Asset aquarium_middle_3_asset {"asset/background/aquarium/glassTubeFG_3_TVOS.png"}; + aquarium_middle_3.add_component<Sprite>( + aquarium_middle_3_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACKGROUND, + .order_in_layer = 4, + .size = vec2(0, GAME_HEIGHT), + } + ); begin_x += 400; this->add_background(scn, begin_x - 200); GameObject aquarium_middle_4 = scn.new_object("aquarium_middle", "background", vec2(begin_x, 0)); - Asset aquarium_middle_4_asset{"asset/background/aquarium/glassTubeFG_3_TVOS.png"}; - aquarium_middle_4.add_component<Sprite>(aquarium_middle_4_asset, - Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_BACKGROUND, - .order_in_layer = 5, - .size = vec2(0, GAME_HEIGHT), - }); + Asset aquarium_middle_4_asset {"asset/background/aquarium/glassTubeFG_3_TVOS.png"}; + aquarium_middle_4.add_component<Sprite>( + aquarium_middle_4_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACKGROUND, + .order_in_layer = 5, + .size = vec2(0, GAME_HEIGHT), + } + ); begin_x += 600; this->add_background(scn, begin_x); GameObject aquarium_end = scn.new_object("aquarium_end", "background", vec2(begin_x, 0)); - Asset aquarium_end_asset{"asset/background/aquarium/glassTubeFG_2_TVOS.png"}; - aquarium_end.add_component<Sprite>(aquarium_end_asset, - Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_BACKGROUND, - .order_in_layer = 1, - .size = vec2(0, GAME_HEIGHT), - }); + Asset aquarium_end_asset {"asset/background/aquarium/glassTubeFG_2_TVOS.png"}; + aquarium_end.add_component<Sprite>( + aquarium_end_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACKGROUND, + .order_in_layer = 1, + .size = vec2(0, GAME_HEIGHT), + } + ); begin_x += 600; return begin_x; @@ -90,54 +102,66 @@ float AquariumSubScene::create(Scene & scn, float begin_x) { void AquariumSubScene::add_background(Scene & scn, float begin_x) { GameObject bg_1 = scn.new_object("aquarium_bg_1", "aquarium_background", vec2(begin_x, 0)); - Asset bg_1_1_asset{"asset/background/aquarium/AquariumBG1_1_TVOS.png"}; - bg_1.add_component<Sprite>(bg_1_1_asset, - Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_BACK_BACKGROUND, - .order_in_layer = 2, - .size = vec2(0, 400), - .position_offset = vec2(-200, 100), - }); - Asset bg_1_2_asset{"asset/background/aquarium/AquariumBG1_2_TVOS.png"}; - bg_1.add_component<Sprite>(bg_1_2_asset, - Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_BACK_BACKGROUND, - .order_in_layer = 2, - .size = vec2(0, 400), - .position_offset = vec2(200, 100), - }); + Asset bg_1_1_asset {"asset/background/aquarium/AquariumBG1_1_TVOS.png"}; + bg_1.add_component<Sprite>( + bg_1_1_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACK_BACKGROUND, + .order_in_layer = 2, + .size = vec2(0, 400), + .position_offset = vec2(-200, 100), + } + ); + Asset bg_1_2_asset {"asset/background/aquarium/AquariumBG1_2_TVOS.png"}; + bg_1.add_component<Sprite>( + bg_1_2_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACK_BACKGROUND, + .order_in_layer = 2, + .size = vec2(0, 400), + .position_offset = vec2(200, 100), + } + ); GameObject bg_2 = scn.new_object("aquarium_bg_2", "aquarium_background", vec2(begin_x, 0)); - Asset bg_2_1_asset{"asset/background/aquarium/AquariumBG2_1_TVOS.png"}; - bg_2.add_component<Sprite>(bg_2_1_asset, - Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_BACK_BACKGROUND, - .order_in_layer = 1, - .size = vec2(0, 400), - .position_offset = vec2(200, -50), - }); - Asset bg_2_2_asset{"asset/background/aquarium/AquariumBG2_2_TVOS.png"}; - bg_2.add_component<Sprite>(bg_2_2_asset, - Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_BACK_BACKGROUND, - .order_in_layer = 1, - .size = vec2(0, 400), - .position_offset = vec2(-200, -50), - }); + Asset bg_2_1_asset {"asset/background/aquarium/AquariumBG2_1_TVOS.png"}; + bg_2.add_component<Sprite>( + bg_2_1_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACK_BACKGROUND, + .order_in_layer = 1, + .size = vec2(0, 400), + .position_offset = vec2(200, -50), + } + ); + Asset bg_2_2_asset {"asset/background/aquarium/AquariumBG2_2_TVOS.png"}; + bg_2.add_component<Sprite>( + bg_2_2_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACK_BACKGROUND, + .order_in_layer = 1, + .size = vec2(0, 400), + .position_offset = vec2(-200, -50), + } + ); GameObject bg_3 = scn.new_object("aquarium_bg_3", "aquarium_background", vec2(begin_x, 0)); - Asset bg_3_1_asset{"asset/background/aquarium/AquariumBG3_1_TVOS.png"}; - bg_3.add_component<Sprite>(bg_3_1_asset, - Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_BACK_BACKGROUND, - .order_in_layer = 0, - .size = vec2(0, 400), - .position_offset = vec2(200, -200), - }); - Asset bg_3_2_asset{"asset/background/aquarium/AquariumBG3_2_TVOS.png"}; - bg_3.add_component<Sprite>(bg_3_2_asset, - Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_BACK_BACKGROUND, - .order_in_layer = 0, - .size = vec2(0, 400), - .position_offset = vec2(-200, -200), - }); + Asset bg_3_1_asset {"asset/background/aquarium/AquariumBG3_1_TVOS.png"}; + bg_3.add_component<Sprite>( + bg_3_1_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACK_BACKGROUND, + .order_in_layer = 0, + .size = vec2(0, 400), + .position_offset = vec2(200, -200), + } + ); + Asset bg_3_2_asset {"asset/background/aquarium/AquariumBG3_2_TVOS.png"}; + bg_3.add_component<Sprite>( + bg_3_2_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACK_BACKGROUND, + .order_in_layer = 0, + .size = vec2(0, 400), + .position_offset = vec2(-200, -200), + } + ); } diff --git a/game/background/ForestParallaxScript.cpp b/game/background/ForestParallaxScript.cpp index 27e30eb..c72f85d 100644 --- a/game/background/ForestParallaxScript.cpp +++ b/game/background/ForestParallaxScript.cpp @@ -3,8 +3,9 @@ using namespace crepe; using namespace std; -ForestParallaxScript::ForestParallaxScript(float begin_x, float end_x, - std::string unique_bg_name) +ForestParallaxScript::ForestParallaxScript( + float begin_x, float end_x, std::string unique_bg_name +) : begin_x(begin_x), end_x(end_x), name(unique_bg_name) {} diff --git a/game/background/ForestSubScene.cpp b/game/background/ForestSubScene.cpp index 7eac53a..a807a36 100644 --- a/game/background/ForestSubScene.cpp +++ b/game/background/ForestSubScene.cpp @@ -17,52 +17,63 @@ using namespace std; float ForestSubScene::create(Scene & scn, float begin_x, std::string unique_bg_name) { GameObject script = scn.new_object("forest_script", "background"); script.add_component<BehaviorScript>().set_script<ForestParallaxScript>( - begin_x - 400, begin_x + 3000 + 400, unique_bg_name); + begin_x - 400, begin_x + 3000 + 400, unique_bg_name + ); this->add_background(scn, begin_x, unique_bg_name); GameObject begin = scn.new_object("forest_begin", "background", vec2(begin_x, 0)); - Asset begin_asset{"asset/background/forest/forestFG_1_TVOS.png"}; - begin.add_component<Sprite>(begin_asset, Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_BACKGROUND, - .order_in_layer = 0, - .size = vec2(0, GAME_HEIGHT), - }); + Asset begin_asset {"asset/background/forest/forestFG_1_TVOS.png"}; + begin.add_component<Sprite>( + begin_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACKGROUND, + .order_in_layer = 0, + .size = vec2(0, GAME_HEIGHT), + } + ); begin_x += 800; this->add_background(scn, begin_x, unique_bg_name); GameObject middle_1 = scn.new_object("forest_middle", "background", vec2(begin_x, 0)); - Asset middle_1_asset{"asset/background/forest/forestFG_3_TVOS.png"}; - middle_1.add_component<Sprite>(middle_1_asset, - Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_BACKGROUND, - .order_in_layer = 2, - .size = vec2(0, GAME_HEIGHT), - }); + Asset middle_1_asset {"asset/background/forest/forestFG_3_TVOS.png"}; + middle_1.add_component<Sprite>( + middle_1_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACKGROUND, + .order_in_layer = 2, + .size = vec2(0, GAME_HEIGHT), + } + ); begin_x += 800; this->add_background(scn, begin_x, unique_bg_name); GameObject middle_2 = scn.new_object("forest_middle", "background", vec2(begin_x, 0)); - Asset middle_2_asset{"asset/background/forest/forestFG_3_TVOS.png"}; - middle_2.add_component<Sprite>(middle_2_asset, - Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_BACKGROUND, - .order_in_layer = 3, - .size = vec2(0, GAME_HEIGHT), - }); + Asset middle_2_asset {"asset/background/forest/forestFG_3_TVOS.png"}; + middle_2.add_component<Sprite>( + middle_2_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACKGROUND, + .order_in_layer = 3, + .size = vec2(0, GAME_HEIGHT), + } + ); begin_x += 800; this->add_background(scn, begin_x, unique_bg_name); GameObject end = scn.new_object("forest_end", "background", vec2(begin_x, 0)); - Asset end_asset{"asset/background/forest/forestFG_2_TVOS.png"}; - end.add_component<Sprite>(end_asset, Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_BACKGROUND, - .order_in_layer = 1, - .size = vec2(0, GAME_HEIGHT), - }); + Asset end_asset {"asset/background/forest/forestFG_2_TVOS.png"}; + end.add_component<Sprite>( + end_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACKGROUND, + .order_in_layer = 1, + .size = vec2(0, GAME_HEIGHT), + } + ); begin_x += 600; this->add_background(scn, begin_x + 200, unique_bg_name); @@ -73,69 +84,84 @@ float ForestSubScene::create(Scene & scn, float begin_x, std::string unique_bg_n void ForestSubScene::add_background(Scene & scn, float begin_x, std::string name) { GameObject bg_1 = scn.new_object("forest_bg_1_" + name, "forest_background", vec2(begin_x, 0)); - Asset bg_1_asset{"asset/background/forest/forestBG1_1_TVOS.png"}; - bg_1.add_component<Sprite>(bg_1_asset, Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_BACK_BACKGROUND, - .order_in_layer = 2, - .size = vec2(0, 800), - }); + Asset bg_1_asset {"asset/background/forest/forestBG1_1_TVOS.png"}; + bg_1.add_component<Sprite>( + bg_1_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACK_BACKGROUND, + .order_in_layer = 2, + .size = vec2(0, 800), + } + ); GameObject bg_2 = scn.new_object("forest_bg_2_" + name, "forest_background", vec2(begin_x, 0)); - Asset bg_2_1_asset{"asset/background/forest/forestBG2_1_TVOS.png"}; - bg_2.add_component<Sprite>(bg_2_1_asset, - Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_BACK_BACKGROUND, - .order_in_layer = 1, - .size = vec2(0, 400), - .position_offset = vec2(200, 0), - }); - Asset bg_2_2_asset{"asset/background/forest/forestBG2_2_TVOS.png"}; - bg_2.add_component<Sprite>(bg_2_2_asset, - Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_BACK_BACKGROUND, - .order_in_layer = 1, - .size = vec2(0, 400), - .position_offset = vec2(-200, 0), - }); + Asset bg_2_1_asset {"asset/background/forest/forestBG2_1_TVOS.png"}; + bg_2.add_component<Sprite>( + bg_2_1_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACK_BACKGROUND, + .order_in_layer = 1, + .size = vec2(0, 400), + .position_offset = vec2(200, 0), + } + ); + Asset bg_2_2_asset {"asset/background/forest/forestBG2_2_TVOS.png"}; + bg_2.add_component<Sprite>( + bg_2_2_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACK_BACKGROUND, + .order_in_layer = 1, + .size = vec2(0, 400), + .position_offset = vec2(-200, 0), + } + ); GameObject bg_3 = scn.new_object("forest_bg_3_" + name, "forest_background", vec2(begin_x, 0)); - Asset bg_3_1_asset{"asset/background/forest/forestBG3_1_TVOS.png"}; - bg_3.add_component<Sprite>(bg_3_1_asset, - Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_BACK_BACKGROUND, - .order_in_layer = 0, - .size = vec2(0, 200), - .position_offset = vec2(300, 0), - }); - Asset bg_3_2_asset{"asset/background/forest/forestBG3_2_TVOS.png"}; - bg_3.add_component<Sprite>(bg_3_2_asset, - Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_BACK_BACKGROUND, - .order_in_layer = 0, - .size = vec2(0, 200), - .position_offset = vec2(100, 0), - }); - Asset bg_3_3_asset{"asset/background/forest/forestBG3_3_TVOS.png"}; - bg_3.add_component<Sprite>(bg_3_3_asset, - Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_BACK_BACKGROUND, - .order_in_layer = 0, - .size = vec2(0, 200), - .position_offset = vec2(-100, 0), - }); - Asset bg_3_4_asset{"asset/background/forest/forestBG3_4_TVOS.png"}; - bg_3.add_component<Sprite>(bg_3_4_asset, - Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_BACK_BACKGROUND, - .order_in_layer = 0, - .size = vec2(0, 200), - .position_offset = vec2(-300, 0), - }); - - bg_2.add_component<Rigidbody>(Rigidbody::Data{ + Asset bg_3_1_asset {"asset/background/forest/forestBG3_1_TVOS.png"}; + bg_3.add_component<Sprite>( + bg_3_1_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACK_BACKGROUND, + .order_in_layer = 0, + .size = vec2(0, 200), + .position_offset = vec2(300, 0), + } + ); + Asset bg_3_2_asset {"asset/background/forest/forestBG3_2_TVOS.png"}; + bg_3.add_component<Sprite>( + bg_3_2_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACK_BACKGROUND, + .order_in_layer = 0, + .size = vec2(0, 200), + .position_offset = vec2(100, 0), + } + ); + Asset bg_3_3_asset {"asset/background/forest/forestBG3_3_TVOS.png"}; + bg_3.add_component<Sprite>( + bg_3_3_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACK_BACKGROUND, + .order_in_layer = 0, + .size = vec2(0, 200), + .position_offset = vec2(-100, 0), + } + ); + Asset bg_3_4_asset {"asset/background/forest/forestBG3_4_TVOS.png"}; + bg_3.add_component<Sprite>( + bg_3_4_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACK_BACKGROUND, + .order_in_layer = 0, + .size = vec2(0, 200), + .position_offset = vec2(-300, 0), + } + ); + + bg_2.add_component<Rigidbody>(Rigidbody::Data { .linear_velocity = vec2(30, 0), }); - bg_3.add_component<Rigidbody>(Rigidbody::Data{ + bg_3.add_component<Rigidbody>(Rigidbody::Data { .linear_velocity = vec2(40, 0), }); } diff --git a/game/background/HallwaySubScene.cpp b/game/background/HallwaySubScene.cpp index 2aa9bab..4d96c94 100644 --- a/game/background/HallwaySubScene.cpp +++ b/game/background/HallwaySubScene.cpp @@ -11,15 +11,19 @@ using namespace crepe; using namespace std; -float HallwaySubScene::create(Scene & scn, float begin_x, unsigned int sector_num, - Color sector_color) { +float HallwaySubScene::create( + Scene & scn, float begin_x, unsigned int sector_num, Color sector_color +) { GameObject begin = scn.new_object("hallway_begin", "background", vec2(begin_x, 0)); - Asset begin_asset{"asset/background/hallway/hallway1FG_1_TVOS.png"}; - begin.add_component<Sprite>(begin_asset, Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_BACKGROUND, - .order_in_layer = 0, - .size = vec2(0, GAME_HEIGHT), - }); + Asset begin_asset {"asset/background/hallway/hallway1FG_1_TVOS.png"}; + begin.add_component<Sprite>( + begin_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACKGROUND, + .order_in_layer = 0, + .size = vec2(0, GAME_HEIGHT), + } + ); begin_x += 600; this->add_sector_number(begin, vec2(-200, 0), sector_num, sector_color); @@ -27,104 +31,128 @@ float HallwaySubScene::create(Scene & scn, float begin_x, unsigned int sector_nu this->add_lamp(begin, vec2(430, -120), 9); GameObject middle_1 = scn.new_object("hallway_middle", "background", vec2(begin_x, 0)); - Asset middle_asset{"asset/background/hallway/hallway1FG_2_TVOS.png"}; - middle_1.add_component<Sprite>(middle_asset, - Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_BACKGROUND, - .order_in_layer = 2, - .size = vec2(0, GAME_HEIGHT), - }); + Asset middle_asset {"asset/background/hallway/hallway1FG_2_TVOS.png"}; + middle_1.add_component<Sprite>( + middle_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACKGROUND, + .order_in_layer = 2, + .size = vec2(0, GAME_HEIGHT), + } + ); begin_x += 600; GameObject middle_2 = scn.new_object("hallway_middle", "background", vec2(begin_x, 0)); - Asset middle_asset_2{"asset/background/hallway/hallway1FG_2_TVOS.png"}; - middle_2.add_component<Sprite>(middle_asset_2, - Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_BACKGROUND, - .order_in_layer = 3, - .size = vec2(0, GAME_HEIGHT), - }); + Asset middle_asset_2 {"asset/background/hallway/hallway1FG_2_TVOS.png"}; + middle_2.add_component<Sprite>( + middle_asset_2, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACKGROUND, + .order_in_layer = 3, + .size = vec2(0, GAME_HEIGHT), + } + ); begin_x += 200; GameObject middle_3 = scn.new_object("hallway_middle", "background", vec2(begin_x, 0)); - Asset middle_asset_3{"asset/background/hallway/hallway1FG_2_TVOS.png"}; - middle_3.add_component<Sprite>(middle_asset_3, - Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_BACKGROUND, - .order_in_layer = 4, - .size = vec2(0, GAME_HEIGHT), - }); + Asset middle_asset_3 {"asset/background/hallway/hallway1FG_2_TVOS.png"}; + middle_3.add_component<Sprite>( + middle_asset_3, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACKGROUND, + .order_in_layer = 4, + .size = vec2(0, GAME_HEIGHT), + } + ); begin_x += 400; this->add_lamp(middle_3, vec2(0, -120)); GameObject middle_4 = scn.new_object("hallway_middle", "background", vec2(begin_x, 0)); - Asset middle_asset_4{"asset/background/hallway/hallway1FG_2_TVOS.png"}; - middle_4.add_component<Sprite>(middle_asset_4, - Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_BACKGROUND, - .order_in_layer = 5, - .size = vec2(0, GAME_HEIGHT), - }); + Asset middle_asset_4 {"asset/background/hallway/hallway1FG_2_TVOS.png"}; + middle_4.add_component<Sprite>( + middle_asset_4, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACKGROUND, + .order_in_layer = 5, + .size = vec2(0, GAME_HEIGHT), + } + ); begin_x += 600; GameObject end = scn.new_object("hallway_end", "background", vec2(begin_x, 0)); - Asset end_asset{"asset/background/hallway/hallway1FG_1_TVOS.png"}; - end.add_component<Sprite>(end_asset, Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_BACKGROUND, - .order_in_layer = 1, - .size = vec2(0, GAME_HEIGHT), - }); + Asset end_asset {"asset/background/hallway/hallway1FG_1_TVOS.png"}; + end.add_component<Sprite>( + end_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACKGROUND, + .order_in_layer = 1, + .size = vec2(0, GAME_HEIGHT), + } + ); begin_x += 600; return begin_x; } void HallwaySubScene::add_lamp(GameObject & obj, vec2 offset, unsigned int fps) { - Asset lamp_asset{"asset/background/hallway/alarmLight_TVOS.png"}; - obj.add_component<Sprite>(lamp_asset, Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND, - .order_in_layer = 0, - .size = vec2(0, 100), - .position_offset = offset, - }); - Asset lamp_glow_asset{"asset/background/hallway/alarmGlow_TVOS.png"}; + Asset lamp_asset {"asset/background/hallway/alarmLight_TVOS.png"}; + obj.add_component<Sprite>( + lamp_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND, + .order_in_layer = 0, + .size = vec2(0, 100), + .position_offset = offset, + } + ); + Asset lamp_glow_asset {"asset/background/hallway/alarmGlow_TVOS.png"}; Sprite & lamp_glow_sprite = obj.add_component<Sprite>( - lamp_glow_asset, Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND, - .order_in_layer = 1, - .size = vec2(0, 300), - .position_offset = offset - vec2(65, -30), - }); - obj.add_component<Animator>(lamp_glow_sprite, ivec2(422, 384), uvec2(6, 1), - Animator::Data{ - .fps = fps, - .looping = true, - }); + lamp_glow_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND, + .order_in_layer = 1, + .size = vec2(0, 300), + .position_offset = offset - vec2(65, -30), + } + ); + obj.add_component<Animator>( + lamp_glow_sprite, ivec2(422, 384), uvec2(6, 1), + Animator::Data { + .fps = fps, + .looping = true, + } + ); } -void HallwaySubScene::add_sector_number(GameObject & obj, vec2 offset, unsigned int sector_num, - Color sector_color) { - Asset sector_text_asset{"asset/background/hallway/sectorText_TVOS.png"}; - obj.add_component<Sprite>(sector_text_asset, - Sprite::Data{ - .color = sector_color, - .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND, - .order_in_layer = 0, - .size = vec2(0, 100), - .position_offset = offset, - }); - Asset sector_num_asset{"asset/background/hallway/sectorNumbers_TVOS.png"}; +void HallwaySubScene::add_sector_number( + GameObject & obj, vec2 offset, unsigned int sector_num, Color sector_color +) { + Asset sector_text_asset {"asset/background/hallway/sectorText_TVOS.png"}; + obj.add_component<Sprite>( + sector_text_asset, + Sprite::Data { + .color = sector_color, + .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND, + .order_in_layer = 0, + .size = vec2(0, 100), + .position_offset = offset, + } + ); + Asset sector_num_asset {"asset/background/hallway/sectorNumbers_TVOS.png"}; Sprite & sector_num_sprite = obj.add_component<Sprite>( - sector_num_asset, Sprite::Data{ - .color = sector_color, - .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND, - .order_in_layer = 0, - .size = vec2(0, 100), - .position_offset = offset + vec2(200, 0), - }); + sector_num_asset, + Sprite::Data { + .color = sector_color, + .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND, + .order_in_layer = 0, + .size = vec2(0, 100), + .position_offset = offset + vec2(200, 0), + } + ); Animator & sector_num_anim = obj.add_component<Animator>( - sector_num_sprite, ivec2(256, 128), uvec2(4, 4), Animator::Data{}); + sector_num_sprite, ivec2(256, 128), uvec2(4, 4), Animator::Data {} + ); int column = (sector_num - 1) / 4; int row = (sector_num - 1) % 4; sector_num_anim.set_anim(column); diff --git a/game/background/HallwaySubScene.h b/game/background/HallwaySubScene.h index acc9329..c38b4a9 100644 --- a/game/background/HallwaySubScene.h +++ b/game/background/HallwaySubScene.h @@ -10,12 +10,15 @@ class Color; class HallwaySubScene { public: - float create(crepe::Scene & scn, float begin_x, unsigned int sector_num, - crepe::Color sector_color); + float create( + crepe::Scene & scn, float begin_x, unsigned int sector_num, crepe::Color sector_color + ); private: void add_lamp(crepe::GameObject & obj, crepe::vec2 offset, unsigned int fps = 10); - void add_sector_number(crepe::GameObject & obj, crepe::vec2 offset, - unsigned int sector_num, crepe::Color sector_color); + void add_sector_number( + crepe::GameObject & obj, crepe::vec2 offset, unsigned int sector_num, + crepe::Color sector_color + ); }; diff --git a/game/background/StartSubScene.cpp b/game/background/StartSubScene.cpp index a918c05..d68287b 100644 --- a/game/background/StartSubScene.cpp +++ b/game/background/StartSubScene.cpp @@ -18,20 +18,25 @@ float StartSubScene::create(Scene & scn, float begin_x) { this->create_wall_fragments(scn, begin_x - 300); 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 = SORT_IN_LAY_BACKGROUND, - .order_in_layer = 0, - .size = vec2(0, GAME_HEIGHT), - }); + Asset begin_asset {"asset/background/start/titleFG_1_TVOS.png"}; + begin.add_component<Sprite>( + begin_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACKGROUND, + .order_in_layer = 0, + .size = vec2(0, GAME_HEIGHT), + } + ); GameObject hole = scn.new_object("start_hole", "background", vec2(begin_x - 250, 140)); - Asset hole_asset{"asset/background/start/titleWallHole.png"}; + Asset hole_asset {"asset/background/start/titleWallHole.png"}; 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_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; @@ -40,12 +45,15 @@ float StartSubScene::create(Scene & scn, float begin_x) { this->add_jetpack_stand(begin, vec2(-125, 200)); 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 = SORT_IN_LAY_BACKGROUND, - .order_in_layer = 1, - .size = vec2(0, GAME_HEIGHT), - }); + Asset end_asset {"asset/background/start/titleFG_2_TVOS.png"}; + end.add_component<Sprite>( + end_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_BACKGROUND, + .order_in_layer = 1, + .size = vec2(0, GAME_HEIGHT), + } + ); begin_x += 100; this->add_lamp(end, vec2(-350, -95)); @@ -54,114 +62,143 @@ 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 = SORT_IN_LAY_FORE_BACKGROUND, - .order_in_layer = 0, - .size = vec2(0, 100), - .position_offset = offset, - }); - Asset lamp_glow_asset{"asset/background/start/alarmGlow_TVOS.png"}; + Asset lamp_asset {"asset/background/start/alarmLight_TVOS.png"}; + obj.add_component<Sprite>( + lamp_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND, + .order_in_layer = 0, + .size = vec2(0, 100), + .position_offset = offset, + } + ); + 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 = SORT_IN_LAY_FORE_BACKGROUND, - .order_in_layer = 1, - .size = vec2(0, 300), - .position_offset = offset - vec2(65, -55), - }); + lamp_glow_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND, + .order_in_layer = 1, + .size = vec2(0, 300), + .position_offset = offset - vec2(65, -55), + } + ); lamp_glow_sprite.active = false; - obj.add_component<Animator>(lamp_glow_sprite, ivec2(422, 384), uvec2(6, 1), - Animator::Data{ - .fps = fps, - .looping = true, - }); + obj.add_component<Animator>( + lamp_glow_sprite, ivec2(422, 384), uvec2(6, 1), + Animator::Data { + .fps = fps, + .looping = true, + } + ); } 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 = SORT_IN_LAY_FORE_BACKGROUND, - .order_in_layer = 0, - .size = vec2(0, 100), - .position_offset = offset, - }); - Asset gramophone_asset{"asset/background/start/gramophone_TVOS.png"}; + Asset table_asset {"asset/background/start/table.png"}; + obj.add_component<Sprite>( + table_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND, + .order_in_layer = 0, + .size = vec2(0, 100), + .position_offset = offset, + } + ); + Asset gramophone_asset {"asset/background/start/gramophone_TVOS.png"}; Sprite & gramophone_sprite = obj.add_component<Sprite>( - gramophone_asset, Sprite::Data{ - .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND, - .order_in_layer = 1, - .size = vec2(0, 100), - .position_offset = offset + vec2(0, -50), - }); - obj.add_component<Animator>(gramophone_sprite, ivec2(64, 128), uvec2(2, 1), - Animator::Data{ - .fps = 10, - .looping = true, - }); + gramophone_asset, + Sprite::Data { + .sorting_in_layer = SORT_IN_LAY_FORE_BACKGROUND, + .order_in_layer = 1, + .size = vec2(0, 100), + .position_offset = offset + vec2(0, -50), + } + ); + obj.add_component<Animator>( + gramophone_sprite, ivec2(64, 128), uvec2(2, 1), + Animator::Data { + .fps = 10, + .looping = true, + } + ); } 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 = 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 = 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 = SORT_IN_LAY_FORE_BACKGROUND, - .order_in_layer = 0, - .size = vec2(0, 100), - .position_offset = offset + vec2(0, 350), - }); + Asset light_asset {"asset/background/start/title_light_TVOS.png"}; + obj.add_component<Sprite>( + light_asset, + Sprite::Data { + .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 = 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 = 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"}; + 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 = 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, - .looping = true, - }) + 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, + .looping = true, + } + ) .pause(); Asset do_not_steal = {"asset/background/start/doNotTouchSign_TVOS.png"}; - 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), - }); + 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"}; + 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 = SORT_IN_LAY_FORE_BACKGROUND, - .order_in_layer = 5, - .size = vec2(0, 50), - }); + 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{ + Rigidbody & frag_1_rb = frag_1.add_component<Rigidbody>(Rigidbody::Data { .gravity_scale = 10, .linear_velocity = vec2(400, 400), .linear_velocity_coefficient = vec2(0.5, 0.6), @@ -175,15 +212,17 @@ void StartSubScene::create_wall_fragments(crepe::Scene & scn, float begin_x) { frag_1.add_component<CircleCollider>(25); GameObject frag_2 = scn.new_object("frag_2", "wall_fragment", vec2(begin_x, 180)); - Asset frag_2_asset{"asset/background/start/StartWall_frag2.png"}; + 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 = SORT_IN_LAY_FORE_BACKGROUND, - .order_in_layer = 5, - .size = vec2(0, 50), - }); + 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{ + Rigidbody & frag_2_rb = frag_2.add_component<Rigidbody>(Rigidbody::Data { .gravity_scale = 20, .linear_velocity = vec2(400, 400), .linear_velocity_coefficient = vec2(0.35, 0.4), @@ -197,15 +236,17 @@ void StartSubScene::create_wall_fragments(crepe::Scene & scn, float begin_x) { frag_2.add_component<CircleCollider>(55); GameObject frag_3 = scn.new_object("frag_3", "wall_fragment", vec2(begin_x, 170)); - Asset frag_3_asset{"asset/background/start/StartWall_frag3.png"}; + 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 = SORT_IN_LAY_FORE_BACKGROUND, - .order_in_layer = 5, - .size = vec2(0, 50), - }); + 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{ + Rigidbody & frag_3_rb = frag_3.add_component<Rigidbody>(Rigidbody::Data { .gravity_scale = 30, .linear_velocity = vec2(400, 400), .linear_velocity_coefficient = vec2(0.3, 0.3), @@ -219,15 +260,17 @@ void StartSubScene::create_wall_fragments(crepe::Scene & scn, float begin_x) { frag_3.add_component<CircleCollider>(35); GameObject frag_4 = scn.new_object("frag_4", "wall_fragment", vec2(begin_x, 160)); - Asset frag_4_asset{"asset/background/start/StartWall_frag4.png"}; + 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 = SORT_IN_LAY_FORE_BACKGROUND, - .order_in_layer = 5, - .size = vec2(0, 50), - }); + 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{ + Rigidbody & frag_4_rb = frag_4.add_component<Rigidbody>(Rigidbody::Data { .gravity_scale = 40, .linear_velocity = vec2(700, 400), .linear_velocity_coefficient = vec2(0.2, 0.2), @@ -241,15 +284,17 @@ void StartSubScene::create_wall_fragments(crepe::Scene & scn, float begin_x) { frag_4.add_component<CircleCollider>(60); GameObject frag_5 = scn.new_object("frag_5", "wall_fragment", vec2(begin_x, 150)); - Asset frag_5_asset{"asset/background/start/StartWall_frag5.png"}; + 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 = SORT_IN_LAY_FORE_BACKGROUND, - .order_in_layer = 5, - .size = vec2(0, 50), - }); + 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{ + Rigidbody & frag_5_rb = frag_5.add_component<Rigidbody>(Rigidbody::Data { .gravity_scale = 50, .linear_velocity = vec2(600, 800), .linear_velocity_coefficient = vec2(0.25, 0.15), @@ -263,15 +308,17 @@ void StartSubScene::create_wall_fragments(crepe::Scene & scn, float begin_x) { frag_5.add_component<CircleCollider>(5); GameObject frag_6 = scn.new_object("frag_6", "wall_fragment", vec2(begin_x, 140)); - Asset frag_6_asset{"asset/background/start/StartWall_frag6.png"}; + 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 = SORT_IN_LAY_FORE_BACKGROUND, - .order_in_layer = 5, - .size = vec2(0, 50), - }); + 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{ + Rigidbody & frag_6_rb = frag_6.add_component<Rigidbody>(Rigidbody::Data { .gravity_scale = 30, .linear_velocity = vec2(300, 800), .linear_velocity_coefficient = vec2(0.35, 0.25), @@ -285,15 +332,17 @@ void StartSubScene::create_wall_fragments(crepe::Scene & scn, float begin_x) { frag_6.add_component<CircleCollider>(30); GameObject frag_7 = scn.new_object("frag_7", "wall_fragment", vec2(begin_x, 130)); - Asset frag_7_asset{"asset/background/start/StartWall_frag7.png"}; + 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 = SORT_IN_LAY_FORE_BACKGROUND, - .order_in_layer = 5, - .size = vec2(0, 50), - }); + 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{ + Rigidbody & frag_7_rb = frag_7.add_component<Rigidbody>(Rigidbody::Data { .gravity_scale = 20, .linear_velocity = vec2(400, 500), .linear_velocity_coefficient = vec2(0.45, 0.6), @@ -307,15 +356,17 @@ void StartSubScene::create_wall_fragments(crepe::Scene & scn, float begin_x) { frag_7.add_component<CircleCollider>(45); GameObject frag_8 = scn.new_object("frag_8", "wall_fragment", vec2(begin_x, 120)); - Asset frag_8_asset{"asset/background/start/StartWall_frag8.png"}; + 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 = SORT_IN_LAY_FORE_BACKGROUND, - .order_in_layer = 5, - .size = vec2(0, 50), - }); + 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{ + Rigidbody & frag_8_rb = frag_8.add_component<Rigidbody>(Rigidbody::Data { .gravity_scale = 30, .linear_velocity = vec2(400, 400), .linear_velocity_coefficient = vec2(0.5, 0.6), @@ -329,15 +380,17 @@ void StartSubScene::create_wall_fragments(crepe::Scene & scn, float begin_x) { frag_8.add_component<CircleCollider>(25); GameObject frag_9 = scn.new_object("frag_9", "wall_fragment", vec2(begin_x, 110)); - Asset frag_9_asset{"asset/background/start/StartWall_frag9.png"}; + 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 = SORT_IN_LAY_FORE_BACKGROUND, - .order_in_layer = 5, - .size = vec2(0, 50), - }); + 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{ + Rigidbody & frag_9_rb = frag_9.add_component<Rigidbody>(Rigidbody::Data { .gravity_scale = 40, .linear_velocity = vec2(200, 400), .linear_velocity_coefficient = vec2(0.5, 0.25), @@ -351,15 +404,17 @@ void StartSubScene::create_wall_fragments(crepe::Scene & scn, float begin_x) { frag_9.add_component<CircleCollider>(15); GameObject frag_10 = scn.new_object("frag_10", "wall_fragment", vec2(begin_x, 100)); - Asset frag_10_asset{"asset/background/start/StartWall_frag10.png"}; + 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 = SORT_IN_LAY_FORE_BACKGROUND, - .order_in_layer = 5, - .size = vec2(0, 50), - }); + 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{ + Rigidbody & frag_10_rb = frag_10.add_component<Rigidbody>(Rigidbody::Data { .gravity_scale = 50, .linear_velocity = vec2(400, 900), .linear_velocity_coefficient = vec2(0.35, 0.4), @@ -373,15 +428,17 @@ void StartSubScene::create_wall_fragments(crepe::Scene & scn, float begin_x) { frag_10.add_component<CircleCollider>(60); GameObject frag_11 = scn.new_object("frag_11", "wall_fragment", vec2(begin_x, 70)); - Asset frag_11_asset{"asset/background/start/StartWall_frag11.png"}; + 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 = SORT_IN_LAY_FORE_BACKGROUND, - .order_in_layer = 5, - .size = vec2(0, 50), - }); + 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{ + Rigidbody & frag_11_rb = frag_11.add_component<Rigidbody>(Rigidbody::Data { .gravity_scale = 60, .linear_velocity = vec2(600, 800), .linear_velocity_coefficient = vec2(0.3, 0.3), @@ -395,15 +452,17 @@ void StartSubScene::create_wall_fragments(crepe::Scene & scn, float begin_x) { frag_11.add_component<CircleCollider>(5); GameObject frag_12 = scn.new_object("frag_12", "wall_fragment", vec2(begin_x, 80)); - Asset frag_12_asset{"asset/background/start/StartWall_frag12.png"}; + 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 = SORT_IN_LAY_FORE_BACKGROUND, - .order_in_layer = 5, - .size = vec2(0, 50), - }); + 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{ + Rigidbody & frag_12_rb = frag_12.add_component<Rigidbody>(Rigidbody::Data { .gravity_scale = 70, .linear_velocity = vec2(500, 800), .linear_velocity_coefficient = vec2(0.25, 0.15), @@ -418,43 +477,51 @@ void StartSubScene::create_wall_fragments(crepe::Scene & scn, float begin_x) { GameObject smoke_particles_1 = scn.new_object("smoke_particles", "particle_emitter", vec2(begin_x - 100, 200)); - Asset smoke_asset_1{"asset/particles/smoke.png"}; + Asset smoke_asset_1 {"asset/particles/smoke.png"}; Sprite & smoke_sprite_1 = smoke_particles_1.add_component<Sprite>( - smoke_asset_1, Sprite::Data{ - .color = Color(255, 255, 255, 50), - .sorting_in_layer = SORT_IN_LAY_PARTICLES_FOREGROUND, - .order_in_layer = 0, - .size = vec2(0, 100), - }); + smoke_asset_1, + Sprite::Data { + .color = Color(255, 255, 255, 50), + .sorting_in_layer = SORT_IN_LAY_PARTICLES_FOREGROUND, + .order_in_layer = 0, + .size = vec2(0, 100), + } + ); ParticleEmitter & emitter_1 = smoke_particles_1.add_component<ParticleEmitter>( - smoke_sprite_1, ParticleEmitter::Data{ - .emission_rate = 20, - .min_speed = 40, - .max_speed = 100, - .min_angle = -30, - .max_angle = 10, - .end_lifespan = 4, - }); + smoke_sprite_1, + ParticleEmitter::Data { + .emission_rate = 20, + .min_speed = 40, + .max_speed = 100, + .min_angle = -30, + .max_angle = 10, + .end_lifespan = 4, + } + ); emitter_1.active = false; GameObject smoke_particles_2 = scn.new_object("smoke_particles", "particle_emitter", vec2(begin_x - 100, 200)); - Asset smoke_asset_2{"asset/particles/smoke.png"}; + Asset smoke_asset_2 {"asset/particles/smoke.png"}; Sprite & smoke_sprite_2 = smoke_particles_2.add_component<Sprite>( - smoke_asset_2, Sprite::Data{ - .color = Color(255, 255, 255, 50), - .sorting_in_layer = SORT_IN_LAY_PARTICLES_FOREGROUND, - .order_in_layer = 0, - .size = vec2(0, 70), - }); + smoke_asset_2, + Sprite::Data { + .color = Color(255, 255, 255, 50), + .sorting_in_layer = SORT_IN_LAY_PARTICLES_FOREGROUND, + .order_in_layer = 0, + .size = vec2(0, 70), + } + ); ParticleEmitter & emitter_2 = smoke_particles_2.add_component<ParticleEmitter>( - smoke_sprite_2, ParticleEmitter::Data{ - .emission_rate = 30, - .min_speed = 40, - .max_speed = 100, - .min_angle = -45, - .max_angle = 5, - .end_lifespan = 3, - }); + smoke_sprite_2, + ParticleEmitter::Data { + .emission_rate = 30, + .min_speed = 40, + .max_speed = 100, + .min_angle = -45, + .max_angle = 5, + .end_lifespan = 3, + } + ); emitter_2.active = false; } |