aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLoek Le Blansch <loek@pipeframe.xyz>2024-12-20 12:57:17 +0100
committerLoek Le Blansch <loek@pipeframe.xyz>2024-12-20 12:57:17 +0100
commit0ba89eff9283d5f9f59fa763a19f4616f1c66d74 (patch)
tree806393e53742896fa5fbe39926b7aa406ef37bfe
parent6570bf598a3b3768fe34827529df5ea0b4b26f0e (diff)
finish moving game
-rw-r--r--game/.crepe-root0
-rw-r--r--game/AquariumSubScene.cpp24
-rw-r--r--game/ForestSubScene.cpp22
-rw-r--r--game/HallwaySubScene.cpp20
-rw-r--r--game/PlayerSubScene.cpp6
-rw-r--r--game/StartSubScene.cpp52
-rw-r--r--game/main.cpp317
7 files changed, 65 insertions, 376 deletions
diff --git a/game/.crepe-root b/game/.crepe-root
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/game/.crepe-root
diff --git a/game/AquariumSubScene.cpp b/game/AquariumSubScene.cpp
index 4f13acf..f4b20f6 100644
--- a/game/AquariumSubScene.cpp
+++ b/game/AquariumSubScene.cpp
@@ -15,7 +15,7 @@ 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/jetpack_joyride/background/aquarium/glassTubeFG_1_TVOS.png"};
+ "asset/background/aquarium/glassTubeFG_1_TVOS.png"};
aquarium_begin.add_component<Sprite>(aquarium_begin_asset, Sprite::Data{
.sorting_in_layer = 4,
.order_in_layer = 0,
@@ -26,7 +26,7 @@ float AquariumSubScene::create(Scene & scn, float begin_x) {
GameObject aquarium_middle_1
= scn.new_object("aquarium_middle", "background", vec2(begin_x, 0));
Asset aquarium_middle_1_asset{
- "asset/jetpack_joyride/background/aquarium/glassTubeFG_3_TVOS.png"};
+ "asset/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,
@@ -39,7 +39,7 @@ float AquariumSubScene::create(Scene & scn, float begin_x) {
GameObject aquarium_middle_2
= scn.new_object("aquarium_middle", "background", vec2(begin_x, 0));
Asset aquarium_middle_2_asset{
- "asset/jetpack_joyride/background/aquarium/glassTubeFG_3_TVOS.png"};
+ "asset/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,
@@ -50,7 +50,7 @@ float AquariumSubScene::create(Scene & scn, float begin_x) {
GameObject aquarium_middle_3
= scn.new_object("aquarium_middle", "background", vec2(begin_x, 0));
Asset aquarium_middle_3_asset{
- "asset/jetpack_joyride/background/aquarium/glassTubeFG_3_TVOS.png"};
+ "asset/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,
@@ -63,7 +63,7 @@ float AquariumSubScene::create(Scene & scn, float begin_x) {
GameObject aquarium_middle_4
= scn.new_object("aquarium_middle", "background", vec2(begin_x, 0));
Asset aquarium_middle_4_asset{
- "asset/jetpack_joyride/background/aquarium/glassTubeFG_3_TVOS.png"};
+ "asset/background/aquarium/glassTubeFG_3_TVOS.png"};
aquarium_middle_4.add_component<Sprite>(aquarium_middle_4_asset, Sprite::Data{
.sorting_in_layer = 4,
.order_in_layer = 5,
@@ -75,7 +75,7 @@ float AquariumSubScene::create(Scene & scn, float begin_x) {
GameObject aquarium_end = scn.new_object("aquarium_end", "background", vec2(begin_x, 0));
Asset aquarium_end_asset{
- "asset/jetpack_joyride/background/aquarium/glassTubeFG_2_TVOS.png"};
+ "asset/background/aquarium/glassTubeFG_2_TVOS.png"};
aquarium_end.add_component<Sprite>(aquarium_end_asset, Sprite::Data{
.sorting_in_layer = 4,
.order_in_layer = 1,
@@ -88,14 +88,14 @@ 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/jetpack_joyride/background/aquarium/AquariumBG1_1_TVOS.png"};
+ 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 = 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"};
+ 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 = 3,
.order_in_layer = 2,
@@ -103,14 +103,14 @@ void AquariumSubScene::add_background(Scene & scn, float begin_x) {
.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/jetpack_joyride/background/aquarium/AquariumBG2_1_TVOS.png"};
+ 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 = 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"};
+ 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 = 3,
.order_in_layer = 1,
@@ -118,14 +118,14 @@ void AquariumSubScene::add_background(Scene & scn, float begin_x) {
.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/jetpack_joyride/background/aquarium/AquariumBG3_1_TVOS.png"};
+ 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 = 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"};
+ 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 = 3,
.order_in_layer = 0,
diff --git a/game/ForestSubScene.cpp b/game/ForestSubScene.cpp
index 9be875d..810ef17 100644
--- a/game/ForestSubScene.cpp
+++ b/game/ForestSubScene.cpp
@@ -20,7 +20,7 @@ float ForestSubScene::create(Scene & scn, float begin_x, std::string unique_bg_n
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/jetpack_joyride/background/forest/forestFG_1_TVOS.png"};
+ Asset begin_asset{"asset/background/forest/forestFG_1_TVOS.png"};
begin.add_component<Sprite>(begin_asset, Sprite::Data{
.sorting_in_layer = 4,
.order_in_layer = 0,
@@ -31,7 +31,7 @@ float ForestSubScene::create(Scene & scn, float begin_x, std::string unique_bg_n
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/jetpack_joyride/background/forest/forestFG_3_TVOS.png"};
+ Asset middle_1_asset{"asset/background/forest/forestFG_3_TVOS.png"};
middle_1.add_component<Sprite>(middle_1_asset, Sprite::Data{
.sorting_in_layer = 4,
.order_in_layer = 2,
@@ -42,7 +42,7 @@ float ForestSubScene::create(Scene & scn, float begin_x, std::string unique_bg_n
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/jetpack_joyride/background/forest/forestFG_3_TVOS.png"};
+ Asset middle_2_asset{"asset/background/forest/forestFG_3_TVOS.png"};
middle_2.add_component<Sprite>(middle_2_asset, Sprite::Data{
.sorting_in_layer = 4,
.order_in_layer = 3,
@@ -53,7 +53,7 @@ float ForestSubScene::create(Scene & scn, float begin_x, std::string unique_bg_n
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/jetpack_joyride/background/forest/forestFG_2_TVOS.png"};
+ Asset end_asset{"asset/background/forest/forestFG_2_TVOS.png"};
end.add_component<Sprite>(end_asset, Sprite::Data{
.sorting_in_layer = 4,
.order_in_layer = 1,
@@ -69,7 +69,7 @@ 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/jetpack_joyride/background/forest/forestBG1_1_TVOS.png"};
+ Asset bg_1_asset{"asset/background/forest/forestBG1_1_TVOS.png"};
bg_1.add_component<Sprite>(bg_1_asset, Sprite::Data{
.sorting_in_layer = 3,
.order_in_layer = 2,
@@ -77,14 +77,14 @@ void ForestSubScene::add_background(Scene & scn, float begin_x, std::string name
});
GameObject bg_2
= scn.new_object("forest_bg_2_" + name, "forest_background", vec2(begin_x, 0));
- Asset bg_2_1_asset{"asset/jetpack_joyride/background/forest/forestBG2_1_TVOS.png"};
+ 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 = 3,
.order_in_layer = 1,
.size = vec2(0, 400),
.position_offset = vec2(200, 0),
});
- Asset bg_2_2_asset{"asset/jetpack_joyride/background/forest/forestBG2_2_TVOS.png"};
+ 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 = 3,
.order_in_layer = 1,
@@ -93,28 +93,28 @@ void ForestSubScene::add_background(Scene & scn, float begin_x, std::string name
});
GameObject bg_3
= scn.new_object("forest_bg_3_" + name, "forest_background", vec2(begin_x, 0));
- Asset bg_3_1_asset{"asset/jetpack_joyride/background/forest/forestBG3_1_TVOS.png"};
+ 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 = 3,
.order_in_layer = 0,
.size = vec2(0, 200),
.position_offset = vec2(300, 0),
});
- Asset bg_3_2_asset{"asset/jetpack_joyride/background/forest/forestBG3_2_TVOS.png"};
+ 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 = 3,
.order_in_layer = 0,
.size = vec2(0, 200),
.position_offset = vec2(100, 0),
});
- Asset bg_3_3_asset{"asset/jetpack_joyride/background/forest/forestBG3_3_TVOS.png"};
+ 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 = 3,
.order_in_layer = 0,
.size = vec2(0, 200),
.position_offset = vec2(-100, 0),
});
- Asset bg_3_4_asset{"asset/jetpack_joyride/background/forest/forestBG3_4_TVOS.png"};
+ 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 = 3,
.order_in_layer = 0,
diff --git a/game/HallwaySubScene.cpp b/game/HallwaySubScene.cpp
index 4fe2267..486b8c6 100644
--- a/game/HallwaySubScene.cpp
+++ b/game/HallwaySubScene.cpp
@@ -12,7 +12,7 @@ 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"};
+ Asset begin_asset{"asset/background/hallway/hallway1FG_1_TVOS.png"};
begin.add_component<Sprite>(begin_asset, Sprite::Data{
.sorting_in_layer = 4,
.order_in_layer = 0,
@@ -25,7 +25,7 @@ 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/jetpack_joyride/background/hallway/hallway1FG_2_TVOS.png"};
+ Asset middle_asset{"asset/background/hallway/hallway1FG_2_TVOS.png"};
middle_1.add_component<Sprite>(middle_asset, Sprite::Data{
.sorting_in_layer = 4,
.order_in_layer = 2,
@@ -34,7 +34,7 @@ float HallwaySubScene::create(Scene & scn, float begin_x, unsigned int sector_nu
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"};
+ Asset middle_asset_2{"asset/background/hallway/hallway1FG_2_TVOS.png"};
middle_2.add_component<Sprite>(middle_asset_2, Sprite::Data{
.sorting_in_layer = 4,
.order_in_layer = 3,
@@ -43,7 +43,7 @@ float HallwaySubScene::create(Scene & scn, float begin_x, unsigned int sector_nu
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"};
+ Asset middle_asset_3{"asset/background/hallway/hallway1FG_2_TVOS.png"};
middle_3.add_component<Sprite>(middle_asset_3, Sprite::Data{
.sorting_in_layer = 4,
.order_in_layer = 4,
@@ -54,7 +54,7 @@ float HallwaySubScene::create(Scene & scn, float begin_x, unsigned int sector_nu
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"};
+ Asset middle_asset_4{"asset/background/hallway/hallway1FG_2_TVOS.png"};
middle_4.add_component<Sprite>(middle_asset_4, Sprite::Data{
.sorting_in_layer = 4,
.order_in_layer = 5,
@@ -63,7 +63,7 @@ float HallwaySubScene::create(Scene & scn, float begin_x, unsigned int sector_nu
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"};
+ Asset end_asset{"asset/background/hallway/hallway1FG_1_TVOS.png"};
end.add_component<Sprite>(end_asset, Sprite::Data{
.sorting_in_layer = 4,
.order_in_layer = 1,
@@ -75,14 +75,14 @@ float HallwaySubScene::create(Scene & scn, float begin_x, unsigned int sector_nu
}
void HallwaySubScene::add_lamp(GameObject & obj, vec2 offset, unsigned int fps) {
- Asset lamp_asset{"asset/jetpack_joyride/background/hallway/alarmLight_TVOS.png"};
+ Asset lamp_asset{"asset/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"};
+ 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 = 5,
@@ -99,7 +99,7 @@ void HallwaySubScene::add_lamp(GameObject & obj, vec2 offset, unsigned int fps)
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"};
+ 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 = 5,
@@ -107,7 +107,7 @@ void HallwaySubScene::add_sector_number(GameObject & obj, vec2 offset, unsigned
.size = vec2(0, 100),
.position_offset = offset,
});
- Asset sector_num_asset{"asset/jetpack_joyride/background/hallway/sectorNumbers_TVOS.png"};
+ 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,
diff --git a/game/PlayerSubScene.cpp b/game/PlayerSubScene.cpp
index 4f4ba9f..01a383a 100644
--- a/game/PlayerSubScene.cpp
+++ b/game/PlayerSubScene.cpp
@@ -12,7 +12,7 @@ using namespace std;
PlayerSubScene::PlayerSubScene(Scene & scn) {
GameObject player = scn.new_object("player", "player", vec2(-100, 200));
- Asset player_body_asset{"asset/jetpack_joyride/barry/defaultBody.png"};
+ Asset player_body_asset{"asset/barry/defaultBody.png"};
Sprite & player_body_sprite
= player.add_component<Sprite>(player_body_asset, Sprite::Data{
.sorting_in_layer = 10,
@@ -24,7 +24,7 @@ PlayerSubScene::PlayerSubScene(Scene & scn) {
.fps = 5,
.looping = true,
});
- Asset player_head_asset{"asset/jetpack_joyride/barry/defaultHead.png"};
+ Asset player_head_asset{"asset/barry/defaultHead.png"};
Sprite & player_head_sprite
= player.add_component<Sprite>(player_head_asset, Sprite::Data{
.sorting_in_layer = 10,
@@ -37,7 +37,7 @@ PlayerSubScene::PlayerSubScene(Scene & scn) {
.fps = 5,
.looping = true,
});
- Asset player_jetpack_asset{"asset/jetpack_joyride/barry/jetpackDefault.png"};
+ Asset player_jetpack_asset{"asset/barry/jetpackDefault.png"};
Sprite & player_jetpack_sprite = player.add_component<Sprite>(
player_jetpack_asset, Sprite::Data{
.sorting_in_layer = 10,
diff --git a/game/StartSubScene.cpp b/game/StartSubScene.cpp
index 07738a4..5d810c2 100644
--- a/game/StartSubScene.cpp
+++ b/game/StartSubScene.cpp
@@ -16,14 +16,14 @@ 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/jetpack_joyride/background/start/titleFG_1_TVOS.png"};
+ Asset begin_asset{"asset/background/start/titleFG_1_TVOS.png"};
begin.add_component<Sprite>(begin_asset, Sprite::Data{
.sorting_in_layer = 4,
.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/jetpack_joyride/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 = 4,
.order_in_layer = 1,
@@ -37,7 +37,7 @@ 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/jetpack_joyride/background/start/titleFG_2_TVOS.png"};
+ Asset end_asset{"asset/background/start/titleFG_2_TVOS.png"};
end.add_component<Sprite>(end_asset, Sprite::Data{
.sorting_in_layer = 4,
.order_in_layer = 1,
@@ -51,14 +51,14 @@ float StartSubScene::create(Scene & scn, float begin_x) {
}
void StartSubScene::add_lamp(GameObject & obj, vec2 offset, unsigned int fps) {
- Asset lamp_asset{"asset/jetpack_joyride/background/start/alarmLight_TVOS.png"};
+ Asset lamp_asset{"asset/background/start/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/start/alarmGlow_TVOS.png"};
+ 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,
@@ -75,14 +75,14 @@ void StartSubScene::add_lamp(GameObject & obj, vec2 offset, unsigned int fps) {
}
void StartSubScene::add_table(GameObject & obj, vec2 offset) {
- Asset table_asset{"asset/jetpack_joyride/background/start/table.png"};
+ Asset table_asset{"asset/background/start/table.png"};
obj.add_component<Sprite>(table_asset, Sprite::Data{
.sorting_in_layer = 5,
.order_in_layer = 0,
.size = vec2(0, 100),
.position_offset = offset,
});
- Asset gramophone_asset{"asset/jetpack_joyride/background/start/gramophone_TVOS.png"};
+ Asset gramophone_asset{"asset/background/start/gramophone_TVOS.png"};
Sprite & gramophone_sprite = obj.add_component<Sprite>(
gramophone_asset, Sprite::Data{
.sorting_in_layer = 5,
@@ -98,21 +98,21 @@ void StartSubScene::add_table(GameObject & obj, vec2 offset) {
}
void StartSubScene::add_light(crepe::GameObject & obj, crepe::vec2 offset) {
- Asset light_asset{"asset/jetpack_joyride/background/start/title_light_TVOS.png"};
+ Asset light_asset{"asset/background/start/title_light_TVOS.png"};
obj.add_component<Sprite>(light_asset, Sprite::Data{
.sorting_in_layer = 5,
.order_in_layer = 0,
.size = vec2(0, 200),
.position_offset = offset,
});
- Asset light_glow_asset{"asset/jetpack_joyride/background/start/lightEffect2.png"};
+ 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),
});
- Asset light_effect_asset{"asset/jetpack_joyride/background/start/lightEffect.png"};
+ 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,
@@ -122,7 +122,7 @@ void StartSubScene::add_light(crepe::GameObject & obj, crepe::vec2 offset) {
}
void StartSubScene::add_jetpack_stand(crepe::GameObject & obj, crepe::vec2 offset) {
- Asset jetpack_stand_asset{"asset/jetpack_joyride/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 = 5,
@@ -136,7 +136,7 @@ void StartSubScene::add_jetpack_stand(crepe::GameObject & obj, crepe::vec2 offse
.looping = true,
})
.pause();
- Asset do_not_steal = {"asset/jetpack_joyride/background/start/doNotTouchSign_TVOS.png"};
+ 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,
@@ -147,7 +147,7 @@ void StartSubScene::add_jetpack_stand(crepe::GameObject & obj, crepe::vec2 offse
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/jetpack_joyride/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 = 5,
@@ -168,7 +168,7 @@ 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/jetpack_joyride/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 = 5,
@@ -189,7 +189,7 @@ 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/jetpack_joyride/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 = 5,
@@ -210,7 +210,7 @@ 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/jetpack_joyride/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 = 5,
@@ -231,7 +231,7 @@ 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/jetpack_joyride/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 = 5,
@@ -252,7 +252,7 @@ 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/jetpack_joyride/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 = 5,
@@ -273,7 +273,7 @@ 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/jetpack_joyride/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 = 5,
@@ -294,7 +294,7 @@ 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/jetpack_joyride/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 = 5,
@@ -315,7 +315,7 @@ 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/jetpack_joyride/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 = 5,
@@ -336,7 +336,7 @@ 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/jetpack_joyride/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 = 5,
@@ -357,7 +357,7 @@ 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, 90));
- Asset frag_11_asset{"asset/jetpack_joyride/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 = 5,
@@ -378,7 +378,7 @@ 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/jetpack_joyride/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 = 5,
@@ -400,7 +400,7 @@ 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/jetpack_joyride/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),
@@ -421,7 +421,7 @@ void StartSubScene::create_wall_fragments(crepe::Scene & scn, float begin_x) {
GameObject smoke_particles_2
= scn.new_object("smoke_particles", "particle_emitter", vec2(begin_x - 100, 200));
- Asset smoke_asset_2{"asset/jetpack_joyride/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),
diff --git a/game/main.cpp b/game/main.cpp
index a028791..325b66d 100644
--- a/game/main.cpp
+++ b/game/main.cpp
@@ -1,322 +1,11 @@
-#include "GameScene.h"
-
#include <crepe/api/Engine.h>
#include <crepe/api/Script.h>
-using namespace crepe;
-using namespace std;
-
-class ScriptBox : public Script {
-public:
- bool oncollision(const CollisionEvent & test) {
- Log::logf("Box {} on_collision() with {}", test.info.self.metadata.game_object_id,
- test.info.other.metadata.game_object_id);
- return true;
- }
-
- void init() {
- subscribe<CollisionEvent>(
- [this](const CollisionEvent & ev) -> bool { return this->oncollision(ev); });
- }
-};
-
-class ScriptCircle : public Script {
-public:
- bool oncollision(const CollisionEvent & test) {
- Log::logf("Circle {} on_collision() with {}", test.info.self.metadata.game_object_id,
- test.info.other.metadata.game_object_id);
- return true;
- }
-
- void init() {
- subscribe<CollisionEvent>(
- [this](const CollisionEvent & ev) -> bool { return this->oncollision(ev); });
- }
-};
-
-class ScriptMoveToLeft : public Script {
-public:
- void update() {
- Transform & transform = this->get_component<Transform>();
- transform.position.x -= 0.02;
- }
-};
-
-class ScriptMoveToRight : public Script {
-public:
- void update() {
- Transform & transform = this->get_component<Transform>();
- transform.position.x += 0.02;
- }
-};
-
-class ConcreteScene1 : public Scene {
-public:
- void load_scene() {
- GameObject camera = this->new_object("camera");
- camera.add_component<Camera>(ivec2(1080, 720), vec2(10, 10),
- Camera::Data{.bg_color = Color::WHITE, .zoom = 1});
-
- GameObject reference = this->new_object("reference", "tag", vec2(0, 0), 0, 1);
- Asset reference_asset = Asset("asset/texture/square.png");
- reference.add_component<Sprite>(reference_asset, Sprite::Data{
- .color = Color::RED,
- .sorting_in_layer = 10,
- .order_in_layer = 0,
- .size = vec2(0.1, 0.1),
- .angle_offset = 0,
- .scale_offset = 1,
- .position_offset = vec2(0, 0),
- });
-
- /*GameObject box_1 = this->new_object("box_1", "tag", vec2(0, 0), 0, 1);
- Asset box_1_asset = Asset("asset/texture/square.png");
- box_1.add_component<Sprite>(box_1_asset, Sprite::Data{
- .sorting_in_layer = 0,
- .order_in_layer = 0,
- .size = vec2(1, 1),
- .angle_offset = 0,
- .scale_offset = 1,
- .position_offset = vec2(0, 0.5),
- });
- Asset box_1_asset2 = Asset("asset/texture/test_ap43.png");
- box_1.add_component<Sprite>(box_1_asset2, Sprite::Data{
- .sorting_in_layer = 0,
- .order_in_layer = 0,
- .size = vec2(1, 1),
- .angle_offset = 0,
- .scale_offset = 1,
- .position_offset = vec2(0, -0.5),
- });*/
-
- /*GameObject particles = this->new_object("particles", "tag", vec2(-1, 0), 180, 1);
- Asset particles_asset = Asset("asset/texture/test_ap43.png");
- Sprite & particles_sprite = particles.add_component<Sprite>(particles_asset, Sprite::Data{
- .sorting_in_layer = 0,
- .order_in_layer = 0,
- .size = vec2(1, 1),
- .angle_offset = 0,
- .scale_offset = 1,
- .position_offset = vec2(0, 0),
- });
- ParticleEmitter & particles_emitter = particles.add_component<ParticleEmitter>(particles_sprite, ParticleEmitter::Data{
- .offset = vec2(0, 0),
- .emission_rate = 1,
- .min_speed = 1,
- .max_speed = 1,
- .min_angle = 0,
- .max_angle = 0,
- .end_lifespan = 4,
- });*/
-
- const bool SCRIPT = false;
-
- const Rigidbody::BodyType BODYTYPE_LEFT = Rigidbody::BodyType::DYNAMIC;
- const Rigidbody::BodyType BODYTYPE_RIGHT = Rigidbody::BodyType::DYNAMIC;
- const bool BOUNCE_LEFT = false;
- const bool BOUNCE_RIGHT = false;
- const bool KINEMATIC_COLLISION = true;
- const bool ONTOP = false;
-
- const float SCALE = 0.5;
- const float OFFSET_X_LEFT = 0;
- const float OFFSET_X_RIGHT = 0;
- const float OFFSET_Y_LEFT = 0;
- const float OFFSET_Y_RIGHT = 0;
-
- GameObject box_1 = this->new_object("box_1", "tag",
- ONTOP ? vec2(-0.25, -4) : vec2(-2, -4), 0, SCALE);
- Asset box_1_asset = Asset("asset/texture/square.png");
- box_1.add_component<Sprite>(box_1_asset,
- Sprite::Data{
- .sorting_in_layer = 0,
- .order_in_layer = 0,
- .size = vec2(1, 1),
- .angle_offset = 0,
- .scale_offset = 1,
- .position_offset = vec2(OFFSET_X_LEFT, OFFSET_Y_LEFT),
- });
- box_1.add_component<Rigidbody>(Rigidbody::Data{
- .gravity_scale = 0,
- .body_type = BODYTYPE_LEFT,
- .linear_velocity = SCRIPT ? vec2{0, 0} : vec2{1, 0},
- .elasticity_coefficient = BOUNCE_LEFT ? 0.5 : 0,
- .kinematic_collision = KINEMATIC_COLLISION,
- });
- box_1.add_component<BehaviorScript>().set_script<ScriptMoveToRight>().active = SCRIPT;
- box_1.add_component<BoxCollider>(vec2(1, 1), vec2(OFFSET_X_LEFT, OFFSET_Y_LEFT));
- box_1.add_component<BehaviorScript>().set_script<ScriptBox>();
-
- GameObject circle_1 = this->new_object("ricle_1", "tag",
- ONTOP ? vec2(0.25, -4) : vec2(2, -4), 0, SCALE);
- Asset circle_1_asset = Asset("asset/texture/circle.png");
- circle_1.add_component<Sprite>(
- circle_1_asset, Sprite::Data{
- .sorting_in_layer = 0,
- .order_in_layer = 0,
- .size = vec2(1, 1),
- .angle_offset = 0,
- .scale_offset = 1,
- .position_offset = vec2(OFFSET_X_RIGHT, OFFSET_Y_RIGHT),
- });
- circle_1.add_component<Rigidbody>(Rigidbody::Data{
- .gravity_scale = 0,
- .body_type = BODYTYPE_RIGHT,
- .linear_velocity = SCRIPT ? vec2{0, 0} : vec2{-1, 0},
- .elasticity_coefficient = BOUNCE_RIGHT ? 0.5 : 0,
- .kinematic_collision = KINEMATIC_COLLISION,
- });
- circle_1.add_component<BehaviorScript>().set_script<ScriptMoveToLeft>().active
- = SCRIPT;
- circle_1.add_component<CircleCollider>(0.5, vec2(OFFSET_X_RIGHT, OFFSET_Y_RIGHT));
- circle_1.add_component<BehaviorScript>().set_script<ScriptCircle>();
-
- GameObject circle_2 = this->new_object(
- "ricle_2", "tag", ONTOP ? vec2(-0.25, -1.5) : vec2(-2.5, -1.5), 0, SCALE);
- Asset circle_2_asset = Asset("asset/texture/circle.png");
- circle_2.add_component<Sprite>(
- circle_2_asset, Sprite::Data{
- .sorting_in_layer = 0,
- .order_in_layer = 0,
- .size = vec2(1, 1),
- .angle_offset = 0,
- .scale_offset = 1,
- .position_offset = vec2(OFFSET_X_LEFT, OFFSET_Y_LEFT),
- });
- circle_2.add_component<Rigidbody>(Rigidbody::Data{
- .gravity_scale = 0,
- .body_type = BODYTYPE_LEFT,
- .linear_velocity = SCRIPT ? vec2{0, 0} : vec2{1, 0},
- .elasticity_coefficient = BOUNCE_LEFT ? 0.5 : 0,
- .kinematic_collision = KINEMATIC_COLLISION,
- });
- circle_2.add_component<BehaviorScript>().set_script<ScriptMoveToRight>().active
- = SCRIPT;
- circle_2.add_component<CircleCollider>(0.5, vec2(OFFSET_X_LEFT, OFFSET_Y_LEFT));
- circle_2.add_component<BehaviorScript>().set_script<ScriptCircle>();
-
- GameObject box_2 = this->new_object(
- "box_2", "tag", ONTOP ? vec2(0.25, -1.5) : vec2(2.5, -1.5), 0, SCALE);
- Asset box_2_asset = Asset("asset/texture/square.png");
- box_2.add_component<Sprite>(
- box_2_asset, Sprite::Data{
- .sorting_in_layer = 0,
- .order_in_layer = 0,
- .size = vec2(1, 1),
- .angle_offset = 0,
- .scale_offset = 1,
- .position_offset = vec2(OFFSET_X_RIGHT, OFFSET_Y_RIGHT),
- });
- box_2.add_component<Rigidbody>(Rigidbody::Data{
- .gravity_scale = 0,
- .body_type = BODYTYPE_RIGHT,
- .linear_velocity = SCRIPT ? vec2{0, 0} : vec2{-1, 0},
- .elasticity_coefficient = BOUNCE_RIGHT ? 0.5 : 0,
- .kinematic_collision = KINEMATIC_COLLISION,
- });
- box_2.add_component<BehaviorScript>().set_script<ScriptMoveToLeft>().active = SCRIPT;
- box_2.add_component<BoxCollider>(vec2(1, 1), vec2(OFFSET_X_RIGHT, OFFSET_Y_RIGHT));
- box_2.add_component<BehaviorScript>().set_script<ScriptBox>();
-
- GameObject box_3 = this->new_object(
- "box_3", "tag", ONTOP ? vec2(-0.25, 1.5) : vec2(-3, 1.5), 0, SCALE);
- Asset box_3_asset = Asset("asset/texture/square.png");
- box_3.add_component<Sprite>(box_3_asset,
- Sprite::Data{
- .sorting_in_layer = 0,
- .order_in_layer = 0,
- .size = vec2(1, 1),
- .angle_offset = 0,
- .scale_offset = 1,
- .position_offset = vec2(OFFSET_X_LEFT, OFFSET_Y_LEFT),
- });
- box_3.add_component<Rigidbody>(Rigidbody::Data{
- .gravity_scale = 0,
- .body_type = BODYTYPE_LEFT,
- .linear_velocity = SCRIPT ? vec2{0, 0} : vec2{1, 0},
- .elasticity_coefficient = BOUNCE_LEFT ? 0.5 : 0,
- .kinematic_collision = KINEMATIC_COLLISION,
- });
- box_3.add_component<BehaviorScript>().set_script<ScriptMoveToRight>().active = SCRIPT;
- box_3.add_component<BoxCollider>(vec2(1, 1), vec2(OFFSET_X_LEFT, OFFSET_Y_LEFT));
- box_3.add_component<BehaviorScript>().set_script<ScriptBox>();
-
- GameObject box_4 = this->new_object("box_4", "tag",
- ONTOP ? vec2(0.25, 1.5) : vec2(3, 1.5), 0, SCALE);
- Asset box_4_asset = Asset("asset/texture/square.png");
- box_4.add_component<Sprite>(
- box_4_asset, Sprite::Data{
- .sorting_in_layer = 0,
- .order_in_layer = 0,
- .size = vec2(1, 1),
- .angle_offset = 0,
- .scale_offset = 1,
- .position_offset = vec2(OFFSET_X_RIGHT, OFFSET_Y_RIGHT),
- });
- box_4.add_component<Rigidbody>(Rigidbody::Data{
- .gravity_scale = 0,
- .body_type = BODYTYPE_RIGHT,
- .linear_velocity = SCRIPT ? vec2{0, 0} : vec2{-1, 0},
- .elasticity_coefficient = BOUNCE_RIGHT ? 0.5 : 0,
- .kinematic_collision = KINEMATIC_COLLISION,
- });
- box_4.add_component<BehaviorScript>().set_script<ScriptMoveToLeft>().active = SCRIPT;
- box_4.add_component<BoxCollider>(vec2(1, 1), vec2(OFFSET_X_RIGHT, OFFSET_Y_RIGHT));
- box_4.add_component<BehaviorScript>().set_script<ScriptBox>();
-
- GameObject circle_3 = this->new_object(
- "ricle_3", "tag", ONTOP ? vec2(-0.25, 4) : vec2(-3.5, 4), 0, SCALE);
- Asset circle_3_asset = Asset("asset/texture/circle.png");
- circle_3.add_component<Sprite>(
- circle_3_asset, Sprite::Data{
- .sorting_in_layer = 0,
- .order_in_layer = 0,
- .size = vec2(1, 1),
- .angle_offset = 0,
- .scale_offset = 1,
- .position_offset = vec2(OFFSET_X_LEFT, OFFSET_Y_LEFT),
- });
- circle_3.add_component<Rigidbody>(Rigidbody::Data{
- .gravity_scale = 0,
- .body_type = BODYTYPE_LEFT,
- .linear_velocity = SCRIPT ? vec2{0, 0} : vec2{1, 0},
- .elasticity_coefficient = BOUNCE_LEFT ? 0.5 : 0,
- .kinematic_collision = KINEMATIC_COLLISION,
- });
- circle_3.add_component<BehaviorScript>().set_script<ScriptMoveToRight>().active
- = SCRIPT;
- circle_3.add_component<CircleCollider>(0.5, vec2(OFFSET_X_LEFT, OFFSET_Y_LEFT));
- circle_3.add_component<BehaviorScript>().set_script<ScriptCircle>();
-
- GameObject circle_4 = this->new_object("ricle_4", "tag",
- ONTOP ? vec2(0.25, 4) : vec2(3.5, 4), 0, SCALE);
- Asset circle_4_asset = Asset("asset/texture/circle.png");
- circle_4.add_component<Sprite>(
- circle_4_asset, Sprite::Data{
- .sorting_in_layer = 0,
- .order_in_layer = 0,
- .size = vec2(1, 1),
- .angle_offset = 0,
- .scale_offset = 1,
- .position_offset = vec2(OFFSET_X_RIGHT, OFFSET_Y_RIGHT),
- });
- circle_4.add_component<Rigidbody>(Rigidbody::Data{
- .gravity_scale = 0,
- .body_type = BODYTYPE_RIGHT,
- .linear_velocity = SCRIPT ? vec2{0, 0} : vec2{-1, 0},
- .elasticity_coefficient = BOUNCE_RIGHT ? 0.5 : 0,
- .kinematic_collision = KINEMATIC_COLLISION,
- });
- circle_4.add_component<BehaviorScript>().set_script<ScriptMoveToLeft>().active
- = SCRIPT;
- circle_4.add_component<CircleCollider>(0.5, vec2(OFFSET_X_RIGHT, OFFSET_Y_RIGHT));
- circle_4.add_component<BehaviorScript>().set_script<ScriptCircle>();
- }
+#include "GameScene.h"
- string get_name() const { return "scene1"; }
-};
+using namespace crepe;
-int main(int argc, char * argv[]) {
+int main() {
Engine gameloop;
gameloop.add_scene<GameScene>();