diff options
author | max-001 <maxsmits21@kpnmail.nl> | 2024-12-16 14:45:32 +0100 |
---|---|---|
committer | max-001 <maxsmits21@kpnmail.nl> | 2024-12-16 14:45:32 +0100 |
commit | ccc7dd1f167daf869fb91118bd3fca8ea796fc8d (patch) | |
tree | 27d88bd7a617edd6b051db55537a654f326df4b7 /src/example | |
parent | 9bd81b51cc6d3ba428a29c7d0d90e289b7229878 (diff) |
Fixed parallax
Diffstat (limited to 'src/example')
-rw-r--r-- | src/example/game.cpp | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/example/game.cpp b/src/example/game.cpp index 62e7732..cfa9d5e 100644 --- a/src/example/game.cpp +++ b/src/example/game.cpp @@ -36,13 +36,13 @@ public: = this->get_components_by_name<Transform>("forest_bg_3_" + name); for (Transform & t : vec_2) { - if (t.position.x < begin_x - 400) { - t.position.x = end_x - 400; + if (t.position.x > end_x - 400) { + t.position.x = begin_x - 400; } } for (Transform & t : vec_3) { - if (t.position.x < begin_x - 400) { - t.position.x = end_x - 400; + if (t.position.x > end_x - 400) { + t.position.x = begin_x - 400; } } } @@ -346,10 +346,10 @@ public: }); bg_2.add_component<Rigidbody>(Rigidbody::Data{ - .linear_velocity = vec2(-0.5, 0), + .linear_velocity = vec2(0.3, 0), }); bg_3.add_component<Rigidbody>(Rigidbody::Data{ - .linear_velocity = vec2(-0.25, 0), + .linear_velocity = vec2(0.4, 0), }); } |