+1 vote

hello everyone,
i am having a weird problem, i have 2 scenes (the first one has a parallax background), i have it set up so the player can move touchs something and it switches to scene 2 then he can go back to scene 1 at the same position he left but when he does that parallax background position is changed, i didnt code anything related to the parallax nodes so i dont really know why is it changing positions.

in Engine by (53 points)

I have the same issue and not found a solution yet :(

I have the exact same issue...

I don't understand the problem !

2 Answers

0 votes

I found a workaround for the problem by adding the following script to the ParallaxBackground:

var layer_positions : PoolVector2Array

func _exit_tree():
    layer_positions.resize(0) #clear the array
    for b in self.get_children():
        #add parallax layer position to the array
        layer_positions.append( b.position ) 

func _enter_tree():
    for idx in layer_positions.size():
        self.get_child(idx).motion_offset = -1 * layer_positions[idx]
by (196 points)
0 votes

I found the solution : you just have to close the scene, restard godot and it works...

If it does it again, just close it again !

by (30 points)
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 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 webmaster@godotengine.org with your username.