From d74263a17e98159b2e3176a5f8e1ff361909c210 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Mon, 25 Dec 2023 12:03:15 +0100 Subject: level backgrounds --- Levels/Level.gd | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) (limited to 'Levels/Level.gd') diff --git a/Levels/Level.gd b/Levels/Level.gd index 0706b0b..910feb8 100644 --- a/Levels/Level.gd +++ b/Levels/Level.gd @@ -1,6 +1,8 @@ extends Node2D +var character: CharacterBody2D + var idx = 0 var timer = 0 @@ -14,8 +16,15 @@ func _ready(): self.set_hud() get_tree().get_root().size_changed.connect(Callable(self, 'resize_hud')) - var character = load("res://Characters/" + Network.player.character + ".tscn").instantiate() + character = load("res://Characters/" + Network.player.character + ".tscn").instantiate() self.set_player(character) + + if has_node("ParallaxBackground"): + $ParallaxBackground/ParallaxLayer.motion_mirroring.x = ( + $ParallaxBackground/ParallaxLayer/Sprite2D.get_rect().size + * + $ParallaxBackground/ParallaxLayer/Sprite2D.scale + ).x func _process(delta): -- cgit v1.2.3