diff options
author | heavydemon21 <nielsstunnebrink1@gmail.com> | 2025-01-08 14:33:38 +0100 |
---|---|---|
committer | heavydemon21 <nielsstunnebrink1@gmail.com> | 2025-01-08 14:33:38 +0100 |
commit | 0729209117a4393e66d7f5b6d83083e2d7c0694c (patch) | |
tree | 0f84c9dcb1ef6ad7268f7508ae6576f6e42fc7e4 | |
parent | b445a1716a46dc875e0b2180c1a1b6022ec7a6d3 (diff) |
made my code work by adding it to the gamescene,main and config
-rw-r--r-- | game/CMakeLists.txt | 4 | ||||
-rw-r--r-- | game/GameScene.cpp | 7 | ||||
-rw-r--r-- | game/main.cpp | 2 | ||||
-rw-r--r-- | game/menus/MenusConfig.h | 2 |
4 files changed, 12 insertions, 3 deletions
diff --git a/game/CMakeLists.txt b/game/CMakeLists.txt index 47adb11..9251b2c 100644 --- a/game/CMakeLists.txt +++ b/game/CMakeLists.txt @@ -16,6 +16,7 @@ add_executable(main background/ForestSubScene.cpp background/HallwaySubScene.cpp background/StartSubScene.cpp + background/HallwayScript.cpp # mainscenes GameScene.cpp @@ -39,9 +40,9 @@ add_executable(main preview/NpcScript.cpp preview/PrevPlayerSubScene.cpp preview/PrevPlayerScript.cpp + main.cpp # scripts - background/HallwayScript.cpp MoveCameraManualyScript.cpp StartGameScript.cpp @@ -58,7 +59,6 @@ add_executable(main workers/CollisionScript.cpp # menus - main.cpp menus/BannerSubScene.cpp menus/ButtonSubScene.cpp menus/IButtonScript.cpp diff --git a/game/GameScene.cpp b/game/GameScene.cpp index 9376eab..f2471fc 100644 --- a/game/GameScene.cpp +++ b/game/GameScene.cpp @@ -10,7 +10,10 @@ #include "hud/HudSubScene.h" #include "hud/SpeedScript.h" #include "menus/endgame/EndGameSubScene.h" +#include "missile/MissilePool.h" +#include "missile/SpawnEvent.h" #include "player/PlayerSubScene.h" +#include "scheduler/ObjectsScheduler.h" #include "workers/WorkersSubScene.h" #include <cmath> @@ -47,11 +50,15 @@ void GameScene::load_scene() { camera.add_component<BehaviorScript>().set_script<CoinSystemScript>(); camera.add_component<BehaviorScript>().set_script<HudScript>(); camera.add_component<BehaviorScript>().set_script<SpeedScript>(); + camera.add_component<BehaviorScript>().set_script<ObjectsScheduler>(); + camera.add_component<BehaviorScript>().set_script<MissileSpawnEventHandler>(); camera.add_component<Rigidbody>(Rigidbody::Data {}); PlayerSubScene player(*this); + MissilePool missile_pool(*this); + WorkersSubScene workers(*this); GameObject floor = new_object("floor", "game_world", vec2(0, 325)); diff --git a/game/main.cpp b/game/main.cpp index e341353..5c050f4 100644 --- a/game/main.cpp +++ b/game/main.cpp @@ -2,6 +2,7 @@ #include <crepe/api/Script.h> #include "GameScene.h" +#include "PreviewScene.h" #include "menus/mainmenu/MainMenuScene.h" #include "menus/shop/ShopMenuScene.h" @@ -12,6 +13,7 @@ int main() { gameloop.add_scene<MainMenuScene>(); gameloop.add_scene<ShopMenuScene>(); gameloop.add_scene<GameScene>(); + gameloop.add_scene<PreviewScene>(); return gameloop.main(); } diff --git a/game/menus/MenusConfig.h b/game/menus/MenusConfig.h index 6ec5689..968f8cc 100644 --- a/game/menus/MenusConfig.h +++ b/game/menus/MenusConfig.h @@ -6,7 +6,7 @@ static constexpr int STARTING_SORTING_IN_LAYER = 7; static constexpr const char * CAMERA_NAME = "camera"; //Scene names static constexpr const char * START_SCENE = "scene1"; -static constexpr const char * PREVIEW_SCENE = "scene1"; +static constexpr const char * PREVIEW_SCENE = "preview scene"; static constexpr const char * SHOP_SCENE = "shopmenu"; static constexpr const char * MAINMENU_SCENE = "mainmenu"; //button config |