diff options
author | Max-001 <maxsmits21@kpnmail.nl> | 2025-01-10 15:19:28 +0100 |
---|---|---|
committer | Max-001 <maxsmits21@kpnmail.nl> | 2025-01-10 15:19:28 +0100 |
commit | 8dcd74c0672014c34175e237120209c15345fbad (patch) | |
tree | 11026e0a7c7b1ea32d12fc8caf970997d94e517e /game/scheduler/ObjectsScheduler.cpp | |
parent | bcf9bd69f173ecee0104c84e4eadc990f17569c6 (diff) |
Fixed Paralax
Diffstat (limited to 'game/scheduler/ObjectsScheduler.cpp')
-rw-r--r-- | game/scheduler/ObjectsScheduler.cpp | 12 |
1 files 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<Rigidbody>("player").front().get().data.linear_velocity.x = PLAYER_SPEED * 0.02; + bool first = true; 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; + 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; } |