From 4eb68c5f5672ed9b5746cc09249dddc804ebd37d Mon Sep 17 00:00:00 2001 From: Max-001 Date: Wed, 8 Jan 2025 18:50:22 +0100 Subject: Background paralax fix at boss fight --- game/scheduler/ObjectsScheduler.cpp | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'game') 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("camera").front().get().data.linear_velocity.x = 0; this->get_components_by_name("player").front().get().data.linear_velocity.x = 0; this->trigger_event(BattleStartEvent {.num_enemies = 2}); + + RefVector rb_back_forest + = this->get_components_by_tag("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("player").front().get().data.linear_velocity.x = PLAYER_SPEED * 0.02; + + RefVector rb_back_forest + = this->get_components_by_tag("forest_background"); + rb_back_forest.front().get().data.linear_velocity.x = 30; + rb_back_forest.back().get().data.linear_velocity.x = 40; + return false; } -- cgit v1.2.3 From 3cc17985b9f3fc666564b5cae36e11ec8beb134a Mon Sep 17 00:00:00 2001 From: Max-001 Date: Wed, 8 Jan 2025 18:55:21 +0100 Subject: Do not move player if x velocity is 0 --- game/player/PlayerEndScript.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'game') 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) { -- cgit v1.2.3 From f189777141024bbad518c921587f15672b1982c2 Mon Sep 17 00:00:00 2001 From: Max-001 Date: Wed, 8 Jan 2025 20:07:39 +0100 Subject: Added check to not walk if velocity is 0 --- game/player/PlayerScript.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'game') 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 #include #include @@ -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("player").front(); + if (prev_anim != 0 && rb.data.linear_velocity.x != 0) { for (Animator & anim : animators) { anim.active = true; anim.set_anim(0); -- cgit v1.2.3 From 903ce5f788f54722dba43dce1ceefe1fd2751e17 Mon Sep 17 00:00:00 2001 From: Max-001 Date: Wed, 8 Jan 2025 20:10:50 +0100 Subject: Disabled move camera manually script --- game/GameScene.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'game') 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().set_script(); + //camera.add_component().set_script(); camera.add_component().set_script(); camera.add_component().set_script(); camera.add_component().set_script(); -- cgit v1.2.3 From 4710a16c01c83633a9afab4bf0b78d2640fe2b08 Mon Sep 17 00:00:00 2001 From: Max-001 Date: Wed, 8 Jan 2025 20:17:51 +0100 Subject: Increased missile sound --- game/missile/MissileSubScene.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'game') 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().set_script().active = false; auto & sound = missle.add_component(missile_fire); - sound.volume = 0.1; + sound.volume = 0.5; auto & sound2 = missle.add_component(explosion_sound); - sound2.volume = 0.1; + sound2.volume = 3; // sprites auto & missle_sprite = missle.add_component( -- cgit v1.2.3