diff options
| author | heavydemon21 <nielsstunnebrink1@gmail.com> | 2025-01-08 16:32:03 +0100 | 
|---|---|---|
| committer | heavydemon21 <nielsstunnebrink1@gmail.com> | 2025-01-08 16:32:03 +0100 | 
| commit | eb3d9ec9baa0b95b95d741a0615adaf4c8c1d3c0 (patch) | |
| tree | 3a35a5dc5efec591b4cadbde90d3888148edbb26 | |
| parent | 8edce6775ab0639a2a6eee3e561d3de0bb0c2cf1 (diff) | |
added preset with nothing
| -rw-r--r-- | game/missile/MissileSubScene.cpp | 4 | ||||
| -rw-r--r-- | game/missile/SpawnEvent.h | 2 | ||||
| -rw-r--r-- | game/scheduler/ObjectsScheduler.cpp | 21 | 
3 files changed, 18 insertions, 9 deletions
| diff --git a/game/missile/MissileSubScene.cpp b/game/missile/MissileSubScene.cpp index db49f88..59d8221 100644 --- a/game/missile/MissileSubScene.cpp +++ b/game/missile/MissileSubScene.cpp @@ -65,6 +65,7 @@ void MissileSubScene::create(crepe::Scene & scn) {  	missle.add_component<Animator>(  		missle_sprite, ivec2 {32, 32}, uvec2 {4, 1},  		Animator::Data { +			.fps = 15,  			.looping = true,  		}  	); @@ -72,6 +73,7 @@ void MissileSubScene::create(crepe::Scene & scn) {  	missle.add_component<Animator>(  		missle_thruster_sprite, ivec2 {64, 64}, uvec2 {4, 2},  		Animator::Data { +			.fps = 15,  			.looping = true,  		}  	); @@ -86,7 +88,7 @@ void MissileSubScene::create(crepe::Scene & scn) {  	missile_explosion_sprite.active = false;  	explosion_anim.active = false; -	std::uniform_int_distribution<> dist(140, 200); +	std::uniform_int_distribution<> dist(200, 250);  	missle.add_component<Rigidbody>(Rigidbody::Data {  		.body_type = Rigidbody::BodyType::KINEMATIC,  		.max_linear_velocity = static_cast<float>(dist(gen)), diff --git a/game/missile/SpawnEvent.h b/game/missile/SpawnEvent.h index ce301fd..58293d7 100644 --- a/game/missile/SpawnEvent.h +++ b/game/missile/SpawnEvent.h @@ -9,7 +9,7 @@ struct MissileSpawnEvent : public crepe::Event {};  class MissileSpawnEventHandler : public crepe::Script {  private: -	static constexpr int MISSILE_OFFSET = VIEWPORT_X / 1.8; +	static constexpr int MISSILE_OFFSET = VIEWPORT_X;  	static constexpr int RANGE = GAME_HEIGHT / 4;  	static constexpr int MIN_RANGE = -RANGE;  	static constexpr int MAX_RANGE = RANGE; diff --git a/game/scheduler/ObjectsScheduler.cpp b/game/scheduler/ObjectsScheduler.cpp index 02d84c1..60e3f47 100644 --- a/game/scheduler/ObjectsScheduler.cpp +++ b/game/scheduler/ObjectsScheduler.cpp @@ -2,8 +2,8 @@  #include "ObjectsScheduler.h" -#include "../Random.h"  #include "../Config.h" +#include "../Random.h"  #include "../missile/SpawnEvent.h"  #include "api/Rigidbody.h"  #include "api/Transform.h" @@ -11,20 +11,25 @@  #include "prefab/ZapperPoolSubScene.h"  using namespace crepe; -void ObjectsScheduler::preset_0() { trigger_event<MissileSpawnEvent>(MissileSpawnEvent {}); } +void ObjectsScheduler::preset_0() { +	trigger_event<MissileSpawnEvent>(MissileSpawnEvent {}); +	trigger_event<MissileSpawnEvent>(MissileSpawnEvent {}); +}  void ObjectsScheduler::preset_1() { trigger_event<MissileSpawnEvent>(MissileSpawnEvent {}); }  void ObjectsScheduler::preset_2() { trigger_event<CreateZapperEvent>(CreateZapperEvent {}); } -void ObjectsScheduler::preset_3() {} +void ObjectsScheduler::preset_3() { trigger_event<CreateZapperEvent>(CreateZapperEvent {}); }  void ObjectsScheduler::preset_4() {} -void ObjectsScheduler::boss_fight_1() {  +void ObjectsScheduler::boss_fight_1() {  	this->get_components_by_name<Rigidbody>("camera").front().get().data.linear_velocity.x = 0;  	this->get_components_by_name<Rigidbody>("player").front().get().data.linear_velocity.x = 0; -	this->trigger_event<BattleStartEvent>(BattleStartEvent{.num_enemies = 2}); +	this->trigger_event<BattleStartEvent>(BattleStartEvent {.num_enemies = 2});  }  bool ObjectsScheduler::boss_fight_1_event() { -	this->get_components_by_name<Rigidbody>("camera").front().get().data.linear_velocity.x = PLAYER_SPEED * 0.02; -	this->get_components_by_name<Rigidbody>("player").front().get().data.linear_velocity.x = PLAYER_SPEED * 0.02; +	this->get_components_by_name<Rigidbody>("camera").front().get().data.linear_velocity.x +		= PLAYER_SPEED * 0.02; +	this->get_components_by_name<Rigidbody>("player").front().get().data.linear_velocity.x +		= PLAYER_SPEED * 0.02;  	return false;  } @@ -32,6 +37,8 @@ void ObjectsScheduler::init() {  	this->obstacles.push_back([this]() { preset_0(); });  	this->obstacles.push_back([this]() { preset_1(); });  	this->obstacles.push_back([this]() { preset_2(); }); +	this->obstacles.push_back([this]() { preset_3(); }); +	this->obstacles.push_back([this]() { preset_4(); });  	this->obstacles.push_back([this]() { boss_fight_1(); }); |