Hello Guys,
so I ran into a small issue, but I cant find the solution to it. So I created the parallax background for the last game (Martian Mike) in the course, and I am at the state where I wanted to use the exported variable to change the background of the newly created 2 levels, from the level scenes and not from the background scene.
We even made a script to do this:
extends ParallaxBackground
@export var bg_texture: CompressedTexture2D = preload(“res://assets/textures/bg/Green.png”)
@export var scroll_speed = 15
@onready var sprite = $ParallaxLayer/Sprite2D
func _ready():
sprite.texture = bg_texture
func _process(delta):
if sprite.region_rect.position >= Vector2(64, 64):
sprite.region_rect.position = Vector2.ZERO
sprite.region_rect.position += delta * Vector2(scroll_speed, scroll_speed)
My code looks exactly like the teachers, there is only 1 difference, I didnt name the scene the same as him.
Also I include a picture where you can see that I cannot see the exported var from the level scene.