diff options
author | JAROWMR <jarorutjes07@gmail.com> | 2025-01-06 11:27:15 +0100 |
---|---|---|
committer | JAROWMR <jarorutjes07@gmail.com> | 2025-01-06 11:27:15 +0100 |
commit | c35a53ff122d9ea3547ef8ae6035bd9e1b10d4cb (patch) | |
tree | 38af0734a951440ffdc7daac0e66aa1ba9b7287b /game/GameScene.cpp | |
parent | 2c4494e371881361e5c883e8fe6952af3400cadc (diff) | |
parent | 20ae1e9dc2043ef3c190f77dd5f9de74bcd533de (diff) |
pull max char
Diffstat (limited to 'game/GameScene.cpp')
-rw-r--r-- | game/GameScene.cpp | 51 |
1 files changed, 50 insertions, 1 deletions
diff --git a/game/GameScene.cpp b/game/GameScene.cpp index 57cb8c4..bd12d50 100644 --- a/game/GameScene.cpp +++ b/game/GameScene.cpp @@ -1,7 +1,6 @@ #include "GameScene.h" #include "Config.h" #include "MoveCameraManualyScript.h" -#include "PlayerSubScene.h" #include "StartGameScript.h" #include "coins/CoinSubScene.h" #include "coins/CoinPool.h" @@ -11,6 +10,7 @@ #include "hud/HudScript.h" #include "hud/HudSubScene.h" #include "hud/SpeedScript.h" +#include "player/PlayerSubScene.h" #include <cmath> #include <crepe/api/Animator.h> @@ -84,6 +84,55 @@ void GameScene::load_scene() { HudSubScene hud; hud.create(*this); + // 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"; } |