diff options
Diffstat (limited to 'game/GameScene.cpp')
-rw-r--r-- | game/GameScene.cpp | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/game/GameScene.cpp b/game/GameScene.cpp index 698677b..c30276a 100644 --- a/game/GameScene.cpp +++ b/game/GameScene.cpp @@ -1,3 +1,20 @@ +#include "GameScene.h" +#include "Config.h" +#include "MoveCameraManualyScript.h" +#include "StartGameScript.h" +#include "coins/CoinSubScene.h" +#include "coins/CoinPool.h" +#include "coins/CoinSystemScript.h" + +#include "background/BackgroundSubScene.h" +#include "hud/HudScript.h" +#include "hud/HudSubScene.h" +#include "hud/SpeedScript.h" +#include "menus/endgame/EndGameSubScene.h" +#include "menus/endgame/EndGameSubScript.h" +#include "player/PlayerSubScene.h" +#include "prefab/ZapperPoolSubScene.h" + #include <cmath> #include <crepe/api/Animator.h> #include <crepe/api/Asset.h> @@ -14,17 +31,6 @@ #include <crepe/api/Transform.h> #include <crepe/types.h> -#include "Config.h" -#include "MoveCameraManualyScript.h" -#include "StartGameScript.h" - -#include "GameScene.h" -#include "MoveCameraManualyScript.h" - -#include "background/BackgroundSubScene.h" -#include "player/PlayerSubScene.h" -#include "prefab/ZapperPoolSubScene.h" - using namespace crepe; using namespace std; @@ -33,7 +39,7 @@ void GameScene::load_scene() { BackgroundSubScene background(*this); - GameObject camera = new_object("camera", "camera", vec2(650, 0)); + GameObject camera = new_object(CAMERA_NAME, "camera", vec2(650, 0)); camera.add_component<Camera>( ivec2(990, 720), vec2(VIEWPORT_X, VIEWPORT_Y), Camera::Data { @@ -41,7 +47,11 @@ void GameScene::load_scene() { } ); camera.add_component<BehaviorScript>().set_script<MoveCameraManualyScript>(); - camera.add_component<Rigidbody>(Rigidbody::Data {}); + camera.add_component<BehaviorScript>().set_script<CoinSystemScript>(); + camera.add_component<BehaviorScript>().set_script<HudScript>(); + camera.add_component<BehaviorScript>().set_script<SpeedScript>(); + + camera.add_component<Rigidbody>(Rigidbody::Data{}); PlayerSubScene player(*this); @@ -74,6 +84,13 @@ void GameScene::load_scene() { GameObject start_game_script = new_object("start_game_script", "script", vec2(0, 0)); start_game_script.add_component<BehaviorScript>().set_script<StartGameScript>(); + //create coin pool + CoinPool coin_system; + coin_system.create_coins(*this); + + HudSubScene hud; + hud.create(*this); + GameObject laser = new_object("laser", "laser", vec2(2000, 0)); Asset laser_asset {"asset/obstacles/laser/laserPower.png"}; Sprite & laser_sprite = laser.add_component<Sprite>( @@ -106,6 +123,9 @@ void GameScene::load_scene() { .collision_layer = COLL_LAY_MISSILE, }); missile.add_component<BoxCollider>(vec2(100, 100)); + + EndGameSubScene endgamewindow; + endgamewindow.create(*this); } string GameScene::get_name() const { return "scene1"; } |