From d8e948463d3e9ab2d871bb89ffc876c7d7444b85 Mon Sep 17 00:00:00 2001 From: max-001 Date: Thu, 12 Dec 2024 19:20:50 +0100 Subject: Improved game --- src/example/game.cpp | 87 +++++++++++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 83 insertions(+), 4 deletions(-) (limited to 'src') diff --git a/src/example/game.cpp b/src/example/game.cpp index 6bdb804..5712358 100644 --- a/src/example/game.cpp +++ b/src/example/game.cpp @@ -29,7 +29,7 @@ public: Asset start_begin_asset{"asset/jetpack_joyride/background/start/titleFG_1_TVOS.png"}; start_begin.add_component(start_begin_asset, Sprite::Data{ .sorting_in_layer = 0, - .order_in_layer = 0, + .order_in_layer = 1, .size = vec2(0, 800), }); @@ -37,7 +37,7 @@ public: Asset start_end_asset{"asset/jetpack_joyride/background/start/titleFG_2_TVOS.png"}; start_end.add_component(start_end_asset, Sprite::Data{ .sorting_in_layer = 0, - .order_in_layer = 1, + .order_in_layer = 2, .size = vec2(0, 800), }); @@ -46,17 +46,96 @@ public: "asset/jetpack_joyride/background/hallway/hallway1FG_1_TVOS.png"}; hallway_begin.add_component(hallway_begin_asset, Sprite::Data{ .sorting_in_layer = 0, - .order_in_layer = 0, + .order_in_layer = 1, .size = vec2(0, 800), }); + GameObject hallway_middle + = mgr.new_object("hallway_middle", "background", vec2(1400, 0)); + Asset hallway_middle_asset{ + "asset/jetpack_joyride/background/hallway/hallway1FG_2_TVOS.png"}; + hallway_middle.add_component(hallway_middle_asset, Sprite::Data{ + .sorting_in_layer = 0, + .order_in_layer = 2, + .size = vec2(0, 800), + }); + + GameObject hallway_end = mgr.new_object("hallway_end", "background", vec2(2000, 0)); + Asset hallway_end_asset{ + "asset/jetpack_joyride/background/hallway/hallway1FG_1_TVOS.png"}; + hallway_end.add_component(hallway_end_asset, Sprite::Data{ + .sorting_in_layer = 0, + .order_in_layer = 1, + .size = vec2(0, 800), + }); + + GameObject forest_begin = mgr.new_object("forest_begin", "background", vec2(2600, 0)); + Asset forest_begin_asset{ + "asset/jetpack_joyride/background/forest/forestFG_1_TVOS.png"}; + forest_begin.add_component(forest_begin_asset, Sprite::Data{ + .sorting_in_layer = 0, + .order_in_layer = 2, + .size = vec2(0, 800), + }); + + GameObject forest_middle + = mgr.new_object("forest_middle", "background", vec2(3400, 0)); + Asset forest_middle_asset{ + "asset/jetpack_joyride/background/forest/forestFG_3_TVOS.png"}; + forest_middle.add_component(forest_middle_asset, Sprite::Data{ + .sorting_in_layer = 0, + .order_in_layer = 2, + .size = vec2(0, 800), + }); + + GameObject forest_end = mgr.new_object("forest_end", "background", vec2(4200, 0)); + Asset forest_end_asset{"asset/jetpack_joyride/background/forest/forestFG_2_TVOS.png"}; + forest_end.add_component(forest_end_asset, Sprite::Data{ + .sorting_in_layer = 0, + .order_in_layer = 2, + .size = vec2(0, 800), + }); + + GameObject forest_background_1 + = mgr.new_object("forest_background", "background", vec2(2600, 0)); + Asset forest_background_1_asset{ + "asset/jetpack_joyride/background/forest/forestBG1_1_TVOS.png"}; + forest_background_1.add_component(forest_background_1_asset, + Sprite::Data{ + .sorting_in_layer = 0, + .order_in_layer = 0, + .size = vec2(0, 800), + }); + + GameObject forest_background_2 + = mgr.new_object("forest_background", "background", vec2(3400, 0)); + Asset forest_background_2_asset{ + "asset/jetpack_joyride/background/forest/forestBG1_1_TVOS.png"}; + forest_background_2.add_component(forest_background_2_asset, + Sprite::Data{ + .sorting_in_layer = 0, + .order_in_layer = 0, + .size = vec2(0, 800), + }); + + GameObject forest_background_3 + = mgr.new_object("forest_background", "background", vec2(4200, 0)); + Asset forest_background_3_asset{ + "asset/jetpack_joyride/background/forest/forestBG1_1_TVOS.png"}; + forest_background_3.add_component(forest_background_3_asset, + Sprite::Data{ + .sorting_in_layer = 0, + .order_in_layer = 0, + .size = vec2(0, 800), + }); + GameObject camera = mgr.new_object("camera", "camera", vec2(600, 0)); camera.add_component(ivec2(1700, 720), vec2(2000, 800), Camera::Data{ .bg_color = Color::RED, }); camera.add_component(Rigidbody::Data{ - .linear_velocity = vec2(1, 0), + .linear_velocity = vec2(1.5, 0), }); } -- cgit v1.2.3