diff options
author | max-001 <maxsmits21@kpnmail.nl> | 2024-12-13 16:46:05 +0100 |
---|---|---|
committer | max-001 <maxsmits21@kpnmail.nl> | 2024-12-13 16:46:05 +0100 |
commit | 9f0676acc2b67e8d3be3503797c0241147bf2489 (patch) | |
tree | d9ba3415648532b589db38abf6edbfd171f62a36 | |
parent | 67cbdbaa87030ccb0cdc20fbb1ebe26fc9758749 (diff) |
Added aquarium
-rw-r--r-- | src/example/game.cpp | 116 |
1 files changed, 108 insertions, 8 deletions
diff --git a/src/example/game.cpp b/src/example/game.cpp index f5f6fd7..93c2f35 100644 --- a/src/example/game.cpp +++ b/src/example/game.cpp @@ -64,10 +64,14 @@ public: this->hallway(mgr, 2, Color::MAGENTA); - this->forest(mgr, "2"); + this->aquarium(mgr); this->hallway(mgr, 3, Color::CYAN); + this->forest(mgr, "2"); + + this->hallway(mgr, 4, Color::GREEN); + this->aquarium(mgr); } @@ -350,6 +354,8 @@ public: } void aquarium(ComponentManager & mgr) { + this->add_background_aquarium(mgr, begin_x); + GameObject aquarium_begin = mgr.new_object("aquarium_begin", "background", vec2(begin_x, 0)); Asset aquarium_begin_asset{ @@ -361,17 +367,60 @@ public: }); begin_x += 600; - GameObject aquarium_middle + GameObject aquarium_middle_1 + = mgr.new_object("aquarium_middle", "background", vec2(begin_x, 0)); + Asset aquarium_middle_1_asset{ + "asset/jetpack_joyride/background/aquarium/glassTubeFG_3_TVOS.png"}; + aquarium_middle_1.add_component<Sprite>(aquarium_middle_1_asset, + Sprite::Data{ + .sorting_in_layer = 4, + .order_in_layer = 2, + .size = vec2(0, 800), + }); + begin_x += 400; + + this->add_background_aquarium(mgr, begin_x - 200); + + GameObject aquarium_middle_2 + = mgr.new_object("aquarium_middle", "background", vec2(begin_x, 0)); + Asset aquarium_middle_2_asset{ + "asset/jetpack_joyride/background/aquarium/glassTubeFG_3_TVOS.png"}; + aquarium_middle_2.add_component<Sprite>(aquarium_middle_2_asset, + Sprite::Data{ + .sorting_in_layer = 4, + .order_in_layer = 3, + .size = vec2(0, 800), + }); + begin_x += 400; + + GameObject aquarium_middle_3 + = mgr.new_object("aquarium_middle", "background", vec2(begin_x, 0)); + Asset aquarium_middle_3_asset{ + "asset/jetpack_joyride/background/aquarium/glassTubeFG_3_TVOS.png"}; + aquarium_middle_3.add_component<Sprite>(aquarium_middle_3_asset, + Sprite::Data{ + .sorting_in_layer = 4, + .order_in_layer = 4, + .size = vec2(0, 800), + }); + begin_x += 400; + + this->add_background_aquarium(mgr, begin_x - 200); + + GameObject aquarium_middle_4 = mgr.new_object("aquarium_middle", "background", vec2(begin_x, 0)); - Asset aquarium_middle_asset{ + Asset aquarium_middle_4_asset{ "asset/jetpack_joyride/background/aquarium/glassTubeFG_3_TVOS.png"}; - aquarium_middle.add_component<Sprite>(aquarium_middle_asset, Sprite::Data{ - .sorting_in_layer = 4, - .order_in_layer = 2, - .size = vec2(0, 800), - }); + aquarium_middle_4.add_component<Sprite>(aquarium_middle_4_asset, + Sprite::Data{ + .sorting_in_layer = 4, + .order_in_layer = 5, + .size = vec2(0, 800), + }); begin_x += 600; + this->add_background_aquarium(mgr, begin_x); + GameObject aquarium_end = mgr.new_object("aquarium_end", "background", vec2(begin_x, 0)); Asset aquarium_end_asset{ @@ -384,6 +433,57 @@ public: begin_x += 600; } + void add_background_aquarium(ComponentManager & mgr, float begin_x) { + GameObject bg_1 + = mgr.new_object("aquarium_bg_1", "aquarium_background", vec2(begin_x, 0)); + Asset bg_1_1_asset{"asset/jetpack_joyride/background/aquarium/AquariumBG1_1_TVOS.png"}; + bg_1.add_component<Sprite>(bg_1_1_asset, Sprite::Data{ + .sorting_in_layer = 3, + .order_in_layer = 2, + .size = vec2(0, 400), + .position_offset = vec2(-200, 100), + }); + Asset bg_1_2_asset{"asset/jetpack_joyride/background/aquarium/AquariumBG1_2_TVOS.png"}; + bg_1.add_component<Sprite>(bg_1_2_asset, Sprite::Data{ + .sorting_in_layer = 3, + .order_in_layer = 2, + .size = vec2(0, 400), + .position_offset = vec2(200, 100), + }); + GameObject bg_2 + = mgr.new_object("aquarium_bg_2", "aquarium_background", vec2(begin_x, 0)); + Asset bg_2_1_asset{"asset/jetpack_joyride/background/aquarium/AquariumBG2_1_TVOS.png"}; + bg_2.add_component<Sprite>(bg_2_1_asset, Sprite::Data{ + .sorting_in_layer = 3, + .order_in_layer = 1, + .size = vec2(0, 400), + .position_offset = vec2(200, -50), + }); + Asset bg_2_2_asset{"asset/jetpack_joyride/background/aquarium/AquariumBG2_2_TVOS.png"}; + bg_2.add_component<Sprite>(bg_2_2_asset, Sprite::Data{ + .sorting_in_layer = 3, + .order_in_layer = 1, + .size = vec2(0, 400), + .position_offset = vec2(-200, -50), + }); + GameObject bg_3 + = mgr.new_object("aquarium_bg_3", "aquarium_background", vec2(begin_x, 0)); + Asset bg_3_1_asset{"asset/jetpack_joyride/background/aquarium/AquariumBG3_1_TVOS.png"}; + bg_3.add_component<Sprite>(bg_3_1_asset, Sprite::Data{ + .sorting_in_layer = 3, + .order_in_layer = 0, + .size = vec2(0, 400), + .position_offset = vec2(200, -200), + }); + Asset bg_3_2_asset{"asset/jetpack_joyride/background/aquarium/AquariumBG3_2_TVOS.png"}; + bg_3.add_component<Sprite>(bg_3_2_asset, Sprite::Data{ + .sorting_in_layer = 3, + .order_in_layer = 0, + .size = vec2(0, 400), + .position_offset = vec2(-200, -200), + }); + } + private: float begin_x = 0; }; |