Godot 3.1 Title screen moving Background

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By TheLastCayen


I want to set up a moving background on my title screen. I am using a ParallaxBackground with a ParallaxLayer. Since this is a menu, I don’t use a camera. I am using this code to move my background:

func _physics_process(delta):
	$ParallaxBackground/ParallaxLayer.motion_offset.x += 1

Those are my settings:

Sprite dimension 640x640
ParallaxLayer motion Mirroring 640x640
Screen resolution: 1280x720

I can’t figure out how to reset the background at the edge of the scene… I tried to move the location but I can’t find a sweet spot.

This is what it looks like :

enter image description here

How can I fix that?

Thank you

:bust_in_silhouette: Reply From: Eric Ellingson


> BaseNode
    > ParallaxBackground
        > ParallaxLayer
            > Sprite
            > Sprite

Where both Sprite nodes are identical, but offset the second sprite by 640 on the x-axis

So simple, I love it.

I moved the second sprite at 1280 on x-axis because I already mirror the first Sprite.

Thank you for your quick answer.

TheLastCayen | 2019-07-28 13:13