aboutsummaryrefslogtreecommitdiff
path: root/game
diff options
context:
space:
mode:
Diffstat (limited to 'game')
-rw-r--r--game/Config.h1
-rw-r--r--game/GameScene.cpp4
-rw-r--r--game/enemy/BattleScript.cpp2
-rw-r--r--game/enemy/EnemyScript.cpp3
-rw-r--r--game/scheduler/ObjectsScheduler.cpp8
-rw-r--r--game/scheduler/ObjectsScheduler.h4
6 files changed, 10 insertions, 12 deletions
diff --git a/game/Config.h b/game/Config.h
index 58a51f2..e4f617a 100644
--- a/game/Config.h
+++ b/game/Config.h
@@ -63,3 +63,4 @@ static constexpr int PLAYER_GRAVITY_SCALE = 60; // In game units
// Jetpack particles
static constexpr const char * JETPACK_PARTICLES = "jetpack_particles";
+static constexpr const char * CAMERA_NAME = "camera";
diff --git a/game/GameScene.cpp b/game/GameScene.cpp
index 07275ab..4cb3671 100644
--- a/game/GameScene.cpp
+++ b/game/GameScene.cpp
@@ -61,9 +61,9 @@ void GameScene::load_scene() {
camera.add_component<BehaviorScript>().set_script<CoinSystemScript>();
camera.add_component<BehaviorScript>().set_script<HudScript>();
camera.add_component<BehaviorScript>().set_script<SpeedScript>();
- camera.add_component<BehaviorScript>().set_script<ObjectsScheduler>();
- camera.add_component<BehaviorScript>().set_script<MissileSpawnEventHandler>();
camera.add_component<BehaviorScript>().set_script<BattleScript>();
+ camera.add_component<BehaviorScript>().set_script<MissileSpawnEventHandler>();
+ camera.add_component<BehaviorScript>().set_script<ObjectsScheduler>();
camera.add_component<Rigidbody>(Rigidbody::Data {});
AI & enemy_path_1 = camera.add_component<AI>(400);
diff --git a/game/enemy/BattleScript.cpp b/game/enemy/BattleScript.cpp
index dde8da1..4260c42 100644
--- a/game/enemy/BattleScript.cpp
+++ b/game/enemy/BattleScript.cpp
@@ -39,7 +39,7 @@ bool BattleScript::create_battle(const BattleStartEvent & e) {
for (int i = 0; i < e.num_enemies; i++) {
BehaviorScript & script = enemy_scripts[i];
script.active = true;
- this->trigger_event<SpawnEnemyEvent>(
+ this->queue_event<SpawnEnemyEvent>(
SpawnEnemyEvent {
.speed = dist(engine),
.column = i,
diff --git a/game/enemy/EnemyScript.cpp b/game/enemy/EnemyScript.cpp
index 8e475a8..07ed9e8 100644
--- a/game/enemy/EnemyScript.cpp
+++ b/game/enemy/EnemyScript.cpp
@@ -84,8 +84,7 @@ bool EnemyScript::spawn_enemy(const SpawnEnemyEvent & e) {
bool EnemyScript::on_collide(const CollisionEvent & e) {
if (e.info.other.metadata.tag == "player_bullet") {
- //this->despawn_enemy();
-
+ this->despawn_enemy();
}
Animator& body_animator = this->get_components<Animator>().front();
body_animator.data.col = 2;
diff --git a/game/scheduler/ObjectsScheduler.cpp b/game/scheduler/ObjectsScheduler.cpp
index 11bb111..02d84c1 100644
--- a/game/scheduler/ObjectsScheduler.cpp
+++ b/game/scheduler/ObjectsScheduler.cpp
@@ -9,7 +9,6 @@
#include "api/Transform.h"
#include "enemy/BattleScript.h"
#include "prefab/ZapperPoolSubScene.h"
-#include <iostream>
using namespace crepe;
void ObjectsScheduler::preset_0() { trigger_event<MissileSpawnEvent>(MissileSpawnEvent {}); }
@@ -20,13 +19,12 @@ void ObjectsScheduler::preset_4() {}
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 = 5});
+ 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;
- this->get_components_by_name<Rigidbody>("player").front().get().data.linear_velocity.x = PLAYER_SPEED;
+ 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;
}
diff --git a/game/scheduler/ObjectsScheduler.h b/game/scheduler/ObjectsScheduler.h
index 1bd0940..56d72cb 100644
--- a/game/scheduler/ObjectsScheduler.h
+++ b/game/scheduler/ObjectsScheduler.h
@@ -15,8 +15,8 @@ private:
int last_boss_check = 0;
int last_obstacle_check = 0;
- int boss_fight_interval = 1000;
- int obstacle_interval = 3000;
+ int boss_fight_interval = 5000;
+ int obstacle_interval = 350;
int start_offset = 1300;
private: