aboutsummaryrefslogtreecommitdiff
path: root/src/example/HallwaySubScene.cpp
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-12-20 12:52:15 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-12-20 12:52:15 +0100
commit6570bf598a3b3768fe34827529df5ea0b4b26f0e (patch)
tree863f6520fd13017dffa5e01ce6b0f60770b4c505 /src/example/HallwaySubScene.cpp
parent43c6971591aaff8ada4adc1b1b4146b19d43f8e9 (diff)
move game files
Diffstat (limited to 'src/example/HallwaySubScene.cpp')
-rw-r--r--src/example/HallwaySubScene.cpp128
1 files changed, 0 insertions, 128 deletions
diff --git a/src/example/HallwaySubScene.cpp b/src/example/HallwaySubScene.cpp
deleted file mode 100644
index 4fe2267..0000000
--- a/src/example/HallwaySubScene.cpp
+++ /dev/null
@@ -1,128 +0,0 @@
-#include "HallwaySubScene.h"
-
-#include <crepe/api/Animator.h>
-#include <crepe/api/Color.h>
-#include <crepe/api/GameObject.h>
-#include <crepe/api/Scene.h>
-#include <crepe/api/Sprite.h>
-
-using namespace crepe;
-using namespace std;
-
-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/jetpack_joyride/background/hallway/hallway1FG_1_TVOS.png"};
- begin.add_component<Sprite>(begin_asset, Sprite::Data{
- .sorting_in_layer = 4,
- .order_in_layer = 0,
- .size = vec2(0, 800),
- });
- begin_x += 600;
-
- this->add_sector_number(begin, vec2(-200, 0), sector_num, sector_color);
- this->add_lamp(begin, vec2(330, -120), 11);
- 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/jetpack_joyride/background/hallway/hallway1FG_2_TVOS.png"};
- middle_1.add_component<Sprite>(middle_asset, Sprite::Data{
- .sorting_in_layer = 4,
- .order_in_layer = 2,
- .size = vec2(0, 800),
- });
- begin_x += 600;
-
- GameObject middle_2 = scn.new_object("hallway_middle", "background", vec2(begin_x, 0));
- Asset middle_asset_2{"asset/jetpack_joyride/background/hallway/hallway1FG_2_TVOS.png"};
- middle_2.add_component<Sprite>(middle_asset_2, Sprite::Data{
- .sorting_in_layer = 4,
- .order_in_layer = 3,
- .size = vec2(0, 800),
- });
- begin_x += 200;
-
- GameObject middle_3 = scn.new_object("hallway_middle", "background", vec2(begin_x, 0));
- Asset middle_asset_3{"asset/jetpack_joyride/background/hallway/hallway1FG_2_TVOS.png"};
- middle_3.add_component<Sprite>(middle_asset_3, Sprite::Data{
- .sorting_in_layer = 4,
- .order_in_layer = 4,
- .size = vec2(0, 800),
- });
- 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/jetpack_joyride/background/hallway/hallway1FG_2_TVOS.png"};
- middle_4.add_component<Sprite>(middle_asset_4, Sprite::Data{
- .sorting_in_layer = 4,
- .order_in_layer = 5,
- .size = vec2(0, 800),
- });
- begin_x += 600;
-
- GameObject end = scn.new_object("hallway_end", "background", vec2(begin_x, 0));
- Asset end_asset{"asset/jetpack_joyride/background/hallway/hallway1FG_1_TVOS.png"};
- end.add_component<Sprite>(end_asset, Sprite::Data{
- .sorting_in_layer = 4,
- .order_in_layer = 1,
- .size = vec2(0, 800),
- });
- begin_x += 600;
-
- return begin_x;
-}
-
-void HallwaySubScene::add_lamp(GameObject & obj, vec2 offset, unsigned int fps) {
- Asset lamp_asset{"asset/jetpack_joyride/background/hallway/alarmLight_TVOS.png"};
- obj.add_component<Sprite>(lamp_asset, Sprite::Data{
- .sorting_in_layer = 5,
- .order_in_layer = 0,
- .size = vec2(0, 100),
- .position_offset = offset,
- });
- Asset lamp_glow_asset{"asset/jetpack_joyride/background/hallway/alarmGlow_TVOS.png"};
- Sprite & lamp_glow_sprite = obj.add_component<Sprite>(
- lamp_glow_asset, Sprite::Data{
- .sorting_in_layer = 5,
- .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/jetpack_joyride/background/hallway/sectorText_TVOS.png"};
- obj.add_component<Sprite>(sector_text_asset, Sprite::Data{
- .color = sector_color,
- .sorting_in_layer = 5,
- .order_in_layer = 0,
- .size = vec2(0, 100),
- .position_offset = offset,
- });
- Asset sector_num_asset{"asset/jetpack_joyride/background/hallway/sectorNumbers_TVOS.png"};
- Sprite & sector_num_sprite = obj.add_component<Sprite>(
- sector_num_asset, Sprite::Data{
- .color = sector_color,
- .sorting_in_layer = 5,
- .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{});
- int column = (sector_num - 1) / 4;
- int row = (sector_num - 1) % 4;
- sector_num_anim.set_anim(column);
- for (int i = 0; i < row; i++) {
- sector_num_anim.next_anim();
- }
- sector_num_anim.pause();
-}