Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | Shortanel |
i am working at a space shooter and when I switch scenes between the title screen and the main game scene the parallax background reset (background is instacieted scene in both title and main game). itried this:
Main game.gd
func _ready():
Global.world = self
for item in Global.star_type:
match item:
"Big":
$HUD/ParallaxBackground/big_stars.position = Global.big_position
"Small":
$HUD/ParallaxBackground/small_stars.position =Global.small_position
func set_position(value):
set("position",value)
Singleton.gd
var star_type =["Big","Small"]
var big_position
var small_position
Title screen.gd
func _on_Start_pressed():
for item in Global.star_type:
match item:
"Big":
Global.big_position = $Game_UI/ParallaxBackground/big_stars.get("motion_offset")
"Small":
Global.small_position = $Game_UI/ParallaxBackground/small_stars.get("motion_offset")
get_tree().change_scene("res://Scene/World/World.tscn")
any way to make iti work?