From 8dcd74c0672014c34175e237120209c15345fbad Mon Sep 17 00:00:00 2001 From: Max-001 Date: Fri, 10 Jan 2025 15:19:28 +0100 Subject: Fixed Paralax --- game/scheduler/ObjectsScheduler.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/game/scheduler/ObjectsScheduler.cpp b/game/scheduler/ObjectsScheduler.cpp index 3ce2018..36bf901 100644 --- a/game/scheduler/ObjectsScheduler.cpp +++ b/game/scheduler/ObjectsScheduler.cpp @@ -37,10 +37,18 @@ bool ObjectsScheduler::boss_fight_1_event() { this->get_components_by_name("player").front().get().data.linear_velocity.x = PLAYER_SPEED * 0.02; + bool first = true; 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; + for (Rigidbody & rb : rb_back_forest) { + if (first == true) { + rb.data.linear_velocity.x = 30; + first = false; + } else { + rb.data.linear_velocity.x = 40; + first = true; + } + } return false; } -- cgit v1.2.3