aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWboerenkamps <wrj.boerenkamps@student.avans.nl>2025-01-10 15:28:52 +0100
committerGitHub <noreply@github.com>2025-01-10 15:28:52 +0100
commit4d4e46551fff8aee9919bdcc550cc4f6090ee218 (patch)
tree11026e0a7c7b1ea32d12fc8caf970997d94e517e
parent0f8bf257d86b5532f3d6f559e5368668c255af7c (diff)
parente07512c7090973b6b4d2dab28d62bc39f0144630 (diff)
Merge pull request #127 from lonkaars/max/game2
Fixed Paralax
-rw-r--r--game/scheduler/ObjectsScheduler.cpp12
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;
}