I am attempting to update the scroll_offset.x
value of a ParallaxBackground
using the following code:
export(int) var scroll_speed: int = 1000
func _process(delta):
scroll_offset.x = scroll_offset.x + scroll_speed*delta
(This approach is adapted from this response to a question about how to make a background scroll when the camera position is fixed).
No matter what value scroll_offset.x
is initialized to, this code causes it to quickly converge to around -1334.724365 after which only the decimal values change (whereas it should continue to increase as far as I understand).
The ParallaxBackground
has a ParallaxLayer
child with Mirroring set to x = 960 and y = 1080 and motion scale set to x = 0.2, y= 0.2. That has a Sprite
child with scale set to x = 2 and y = 2. The resource for the sprite is a PNG that is 960X540. I have tried importing it with Repeat Enabled, Mirrored, or Disabled, and none of those settings worked.
Setting scroll_offset.x
to any fixed value works, including values much more extreme than what it appears to "converge to", but somehow incrementing in _process
isn't working. What simple thing am I missing here?