The parallax nodes makes infinite backgrounds in godot really easy.
Add these three nodes to your background scene:
ParallaxBackground
--┖╴ParallaxLayer
---- ┖╴Sprite
Then add your background image to the sprite. On the parallaxLayer node set the mirroring x and y to the dimensions of your background image.
the background will keep up with the camera, so however you move the camera the background will be handled automatically.
if you are building something like a title screen, without a camera node, then you can handle the scroll manually.
constantly move the background to the right:
extends ParallaxBackground
func _process(delta):
scroll_offset.x += 1000 * delta
or move the background in a circle:
extends ParallaxBackground
export(int) var speed: int = 1000
export(float) var rotation_speed = 0.4
var direction = Vector2(1, 0)
func _process(delta):
scroll_offset += direction * speed * delta
direction = direction.rotated(rotation_speed * delta)