-
-
Notifications
You must be signed in to change notification settings - Fork 1
Implement Parallax Scrolling Background linked to Player Speed #574
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
ikostan
merged 37 commits into
main
from
implement-parallax-scrolling-background-linked-to-player-speed
Apr 19, 2026
Merged
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
6c8427d
[FEATURE] Implement Parallax Scrolling Background linked to Player Sp…
ikostan 1246521
Update main_scene.gd
ikostan b137b63
Update scripts/main_scene.gd
ikostan e436db6
Update main_scene.gd
ikostan e3a9b70
Update main_scene.gd
ikostan 7040237
Here is a comprehensive GUT unit test suite for the new parallax_mana…
ikostan d6b27ed
Update parallax_manager.gd
ikostan 64b1bbc
completely eliminate the _process polling by using Dependency Inject…
ikostan 1dbb09d
Missing coverage for the fuel-depletion reset, and tests implicitly d…
ikostan 6af4227
Update test/gut/test_parallax_manager.gd
ikostan d5cc59a
Update main_scene.gd
ikostan 39bd963
Update parallax_manager.gd
ikostan ee92636
Update main_scene.gd
ikostan 43ed4c2
Update main_scene.gd
ikostan f6eeb1f
Update main_scene.gd
ikostan 19467a2
scroll_offset.y grows unboundedly — consider wrapping to preserve flo…
ikostan bc0702e
Update main_scene.gd
ikostan b101d71
Update parallax_manager.gd
ikostan 9abb76a
126-148: Nit: test name/assertion message is slightly misleading.
ikostan 2c99f7c
63-67: LGTM — refuel recovery path is correctly wired.
ikostan 27a0903
Update main_scene.gd
ikostan 0117f9f
Update parallax_manager.gd
ikostan 87efef1
Update main_scene.gd
ikostan 189ec21
Update main_scene.gd
ikostan 14084a0
This fully resolves the reviewer's concern by creating a proper, publ…
ikostan b7d5b25
let the ParallaxManager inspect its own children and calculate the ma…
ikostan ba0fb22
player's speed is now rigorously typed
ikostan cafaa32
Unit test updates
ikostan a8a50fe
Update test/gut/test_parallax_manager.gd
ikostan 539986c
Update GUT unit tests
ikostan e1c8628
Merge branch 'implement-parallax-scrolling-background-linked-to-playe…
ikostan de072dc
auto_calculate_wrap_period() silently disables wrap when no layers ar…
ikostan d08fb80
Update parallax_manager.gd
ikostan cac27df
Optional: max-of-periods is only safe when layer periods are commens…
ikostan 5fdc662
Update scripts/main_scene.gd
ikostan 4c3c8ec
Update main_scene.gd
ikostan e6cfa37
Update parallax_manager.gd
ikostan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,33 @@ | ||
| ## Copyright (C) 2026 Egor Kostan | ||
| ## SPDX-License-Identifier: GPL-3.0-or-later | ||
| ## parallax_manager.gd | ||
| ## Manages the scrolling speed of the parallax background based on player velocity. | ||
| ## Decoupled from direct physics polling via the Observer Pattern. | ||
|
|
||
| class_name ParallaxManager | ||
| extends ParallaxBackground | ||
|
|
||
| var _current_speed: float = 0.0 | ||
|
|
||
|
|
||
| ## Observer callback triggered when the player's speed changes. | ||
| ## Updates the internal speed used for parallax scrolling. | ||
| ## @param new_speed: float - The new forward speed of the player. | ||
| ## @param _max_speed: float - The maximum speed threshold (unused). | ||
| ## @return: void | ||
| func _on_player_speed_changed(new_speed: float, _max_speed: float) -> void: | ||
| _current_speed = new_speed | ||
|
|
||
|
|
||
| ## Called every physics/rendering frame. Updates the vertical scroll offset | ||
| ## based on the cached player speed and current game difficulty. | ||
| ## @param delta: float - The elapsed time since the previous frame. | ||
| ## @return: void | ||
| func _process(delta: float) -> void: | ||
| var difficulty: float = 1.0 | ||
|
|
||
| if is_instance_valid(Globals) and is_instance_valid(Globals.settings): | ||
| difficulty = Globals.settings.difficulty | ||
|
|
||
| var scroll_amount: float = _current_speed * delta * difficulty * 0.8 | ||
| scroll_offset.y += scroll_amount |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| uid://b5x2ehdthhrla |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.