This site is currently in read-only mode during migration to a new platform.
You cannot post questions, answers or comments, as they would be lost during the migration otherwise.
0 votes

Hi,

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

in Engine by (24 points)

1 Answer

0 votes
Best answer

Try:

> BaseNode
    > ParallaxBackground
        > ParallaxLayer
            > Sprite
            > Sprite

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

by (1,663 points)
selected by

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.

Welcome to Godot Engine Q&A, where you can ask questions and receive answers from other members of the community.

Please make sure to read Frequently asked questions and How to use this Q&A? before posting your first questions.
Social login is currently unavailable. If you've previously logged in with a Facebook or GitHub account, use the I forgot my password link in the login box to set a password for your account. If you still can't access your account, send an email to [email protected] with your username.