aboutsummaryrefslogtreecommitdiff
path: root/game/GameScene.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'game/GameScene.cpp')
-rw-r--r--game/GameScene.cpp52
1 files changed, 51 insertions, 1 deletions
diff --git a/game/GameScene.cpp b/game/GameScene.cpp
index 2511567..a8fcb47 100644
--- a/game/GameScene.cpp
+++ b/game/GameScene.cpp
@@ -1,10 +1,10 @@
#include "GameScene.h"
#include "Config.h"
#include "MoveCameraManualyScript.h"
-#include "PlayerSubScene.h"
#include "StartGameScript.h"
#include "background/BackgroundSubScene.h"
+#include "player/PlayerSubScene.h"
#include <cmath>
#include <crepe/api/Animator.h>
@@ -66,6 +66,56 @@ 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>();
+
+ // 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"};
+ Sprite & zapper_sprite = zapper.add_component<Sprite>(
+ zapper_asset,
+ Sprite::Data {
+ .sorting_in_layer = SORT_IN_LAY_OBSTACLES,
+ .order_in_layer = 0,
+ .size = vec2(100, 100),
+ }
+ );
+ zapper.add_component<Rigidbody>(Rigidbody::Data {
+ .body_type = Rigidbody::BodyType::KINEMATIC,
+ .kinematic_collision = false,
+ .collision_layer = COLL_LAY_ZAPPER,
+ });
+ zapper.add_component<BoxCollider>(vec2(100, 100));
+ GameObject laser = new_object("laser", "laser", vec2(2000, 0));
+ Asset laser_asset {"asset/obstacles/laser/laserPower.png"};
+ Sprite & laser_sprite = laser.add_component<Sprite>(
+ laser_asset,
+ Sprite::Data {
+ .sorting_in_layer = SORT_IN_LAY_OBSTACLES,
+ .order_in_layer = 0,
+ .size = vec2(100, 100),
+ }
+ );
+ laser.add_component<Rigidbody>(Rigidbody::Data {
+ .body_type = Rigidbody::BodyType::KINEMATIC,
+ .kinematic_collision = false,
+ .collision_layer = COLL_LAY_LASER,
+ });
+ laser.add_component<BoxCollider>(vec2(100, 100));
+ GameObject missile = new_object("missile", "missile", vec2(4000, 0));
+ Asset missile_asset {"asset/obstacles/missile/missile.png"};
+ Sprite & missile_sprite = missile.add_component<Sprite>(
+ missile_asset,
+ Sprite::Data {
+ .sorting_in_layer = SORT_IN_LAY_OBSTACLES,
+ .order_in_layer = 0,
+ .size = vec2(100, 100),
+ }
+ );
+ missile.add_component<Rigidbody>(Rigidbody::Data {
+ .body_type = Rigidbody::BodyType::KINEMATIC,
+ .kinematic_collision = false,
+ .collision_layer = COLL_LAY_MISSILE,
+ });
+ missile.add_component<BoxCollider>(vec2(100, 100));
}
string GameScene::get_name() const { return "scene1"; }