aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--game/GameScene.cpp2
-rw-r--r--game/missile/MissileSubScene.cpp4
-rw-r--r--game/player/PlayerEndScript.cpp4
-rw-r--r--game/player/PlayerScript.cpp4
-rw-r--r--game/scheduler/ObjectsScheduler.cpp12
5 files changed, 21 insertions, 5 deletions
diff --git a/game/GameScene.cpp b/game/GameScene.cpp
index 3ae64fb..ea55f7b 100644
--- a/game/GameScene.cpp
+++ b/game/GameScene.cpp
@@ -55,7 +55,7 @@ void GameScene::load_scene() {
.bg_color = Color::BLACK,
}
);
- camera.add_component<BehaviorScript>().set_script<MoveCameraManualyScript>();
+ //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>();
diff --git a/game/missile/MissileSubScene.cpp b/game/missile/MissileSubScene.cpp
index 59d8221..6719c3d 100644
--- a/game/missile/MissileSubScene.cpp
+++ b/game/missile/MissileSubScene.cpp
@@ -29,9 +29,9 @@ void MissileSubScene::create(crepe::Scene & scn) {
missle.add_component<BehaviorScript>().set_script<MissileScript>().active = false;
auto & sound = missle.add_component<AudioSource>(missile_fire);
- sound.volume = 0.1;
+ sound.volume = 0.5;
auto & sound2 = missle.add_component<AudioSource>(explosion_sound);
- sound2.volume = 0.1;
+ sound2.volume = 3;
// sprites
auto & missle_sprite = missle.add_component<Sprite>(
diff --git a/game/player/PlayerEndScript.cpp b/game/player/PlayerEndScript.cpp
index 047dbb0..4ae813f 100644
--- a/game/player/PlayerEndScript.cpp
+++ b/game/player/PlayerEndScript.cpp
@@ -62,7 +62,9 @@ bool PlayerEndScript::on_collision(const crepe::CollisionEvent & ev) {
rb_player.data.angular_velocity = 0;
rb_player.data.elasticity_coefficient = 0;
- rb_player.data.linear_velocity = vec2(PLAYER_SPEED * dt, 0);
+ if (rb_player.data.linear_velocity.x != 0) {
+ rb_player.data.linear_velocity = vec2(PLAYER_SPEED * dt, 0);
+ }
rb_player.data.linear_velocity_coefficient = vec2(0.5, 0.5);
rb_camera.data.linear_velocity_coefficient = vec2(0.5, 0.5);
for (Animator & anim : anim_player) {
diff --git a/game/player/PlayerScript.cpp b/game/player/PlayerScript.cpp
index 57819c0..fadca9c 100644
--- a/game/player/PlayerScript.cpp
+++ b/game/player/PlayerScript.cpp
@@ -2,6 +2,7 @@
#include "../Config.h"
#include "../enemy/BattleScript.h"
+
#include <crepe/api/Animator.h>
#include <crepe/api/AudioSource.h>
#include <crepe/api/BoxCollider.h>
@@ -126,7 +127,8 @@ void PlayerScript::fixed_update(crepe::duration_t dt) {
current_jetpack_sound = 0;
}
} else if (transform.position.y == 195) {
- if (prev_anim != 0) {
+ Rigidbody & rb = this->get_components_by_name<Rigidbody>("player").front();
+ if (prev_anim != 0 && rb.data.linear_velocity.x != 0) {
for (Animator & anim : animators) {
anim.active = true;
anim.set_anim(0);
diff --git a/game/scheduler/ObjectsScheduler.cpp b/game/scheduler/ObjectsScheduler.cpp
index 60e3f47..3ce2018 100644
--- a/game/scheduler/ObjectsScheduler.cpp
+++ b/game/scheduler/ObjectsScheduler.cpp
@@ -23,6 +23,12 @@ 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});
+
+ RefVector<Rigidbody> rb_back_forest
+ = this->get_components_by_tag<Rigidbody>("forest_background");
+ for (Rigidbody & rb : rb_back_forest) {
+ rb.data.linear_velocity.x = 0;
+ }
}
bool ObjectsScheduler::boss_fight_1_event() {
@@ -30,6 +36,12 @@ bool ObjectsScheduler::boss_fight_1_event() {
= PLAYER_SPEED * 0.02;
this->get_components_by_name<Rigidbody>("player").front().get().data.linear_velocity.x
= PLAYER_SPEED * 0.02;
+
+ RefVector<Rigidbody> rb_back_forest
+ = this->get_components_by_tag<Rigidbody>("forest_background");
+ rb_back_forest.front().get().data.linear_velocity.x = 30;
+ rb_back_forest.back().get().data.linear_velocity.x = 40;
+
return false;
}