diff options
Diffstat (limited to 'game/GameScene.cpp')
-rw-r--r-- | game/GameScene.cpp | 46 |
1 files changed, 29 insertions, 17 deletions
diff --git a/game/GameScene.cpp b/game/GameScene.cpp index af6fc61..383d96c 100644 --- a/game/GameScene.cpp +++ b/game/GameScene.cpp @@ -2,18 +2,26 @@ #include "Config.h" #include "MoveCameraManualyScript.h" #include "StartGameScript.h" +#include "coins/CoinPoolSubScene.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 "player/PlayerSubScene.h" #include "player/PlayerBulletPool.h" #include "player/PlayerBulletSubScene.h" #include "enemy/EnemyPool.h" #include "enemy/EnemySubScene.h" #include "enemy/EnemyBulletPool.h" -#include "enemy/BattleScript.h" +#include "enemy/BattleScript.h"#include "workers/WorkersSubScene.h" + #include <cmath> #include <crepe/api/Animator.h> #include <crepe/api/Asset.h> +#include <crepe/api/AudioSource.h> #include <crepe/api/BehaviorScript.h> #include <crepe/api/BoxCollider.h> #include <crepe/api/Camera.h> @@ -42,6 +50,10 @@ void GameScene::load_scene() { } ); camera.add_component<BehaviorScript>().set_script<MoveCameraManualyScript>(); + 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 {}); AI& enemy_path_1 = camera.add_component<AI>(400); enemy_path_1.make_oval_path(100, 100, camera.transform.position, 1.5708, true); @@ -52,6 +64,8 @@ void GameScene::load_scene() { // camer.add_component<AI> PlayerSubScene player(*this); + WorkersSubScene workers(*this); + GameObject floor = new_object("floor", "game_world", vec2(0, 325)); floor.add_component<Rigidbody>(Rigidbody::Data { .body_type = Rigidbody::BodyType::STATIC, @@ -79,6 +93,20 @@ 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 + CoinPoolSubScene coin_system; + coin_system.create_coins(*this); + + HudSubScene hud; + hud.create(*this); + GameObject background_music = new_object("background_music", "audio", vec2(0, 0)); + Asset background_music_asset {"asset/music/level.ogg"}; + background_music.add_component<AudioSource>(background_music_asset); + + GameObject boom_audio = new_object("boom_audio", "audio", vec2(0, 0)); + Asset boom_audio_asset {"asset/sfx/window_smash.ogg"}; + boom_audio.add_component<AudioSource>(boom_audio_asset); + // zapper, laser and missile (below) for testing purpose only!!! GameObject zapper = new_object("zapper", "zapper", vec2(1000, 0)); Asset zapper_asset {"asset/obstacles/zapper/regular_zappers/zapEffect.png"}; @@ -128,22 +156,6 @@ void GameScene::load_scene() { .collision_layer = COLL_LAY_MISSILE, }); missile.add_component<BoxCollider>(vec2(100, 100)); - //Enemy pool - EnemyPool enemy_pool; - enemy_pool.create_enemies(*this); - PlayerBulletPool player_bullet_pool; - player_bullet_pool.create_bullets(*this); - //Enemy Bullet pool - // PlayerBulletSubScene player_bullet; - // player_bullet.create(*this); - EnemyBulletPool enemy_bullet_pool; - enemy_bullet_pool.create_bullets(*this); - BehaviorScript& script = camera.add_component<BehaviorScript>().set_script<BattleScript>(); - - // EnemySubScene enemy_sub_scene1; - // enemy_sub_scene1.create(*this); - // EnemySubScene enemy_sub_scene2; - // enemy_sub_scene2.create(*this); } string GameScene::get_name() const { return "scene1"; } |