Bg is not scrolling when used in start_menu

(lecture: Start Menu | GameDev.tv)

The bg scene does not scroll when instantiating it from the user interface node. Any idea what it could be?

My bg script is:

extends ParallaxBackground

@onready var sprite = $ParallaxLayer/Sprite2D
@export var scroll_speed = 15
@export var bg_texture: CompressedTexture2D = preload("res://assets/textures/bg/Blue.png")

func _ready():
	sprite.texture = bg_texture

func _process(delta):
	sprite.region_rect.position += delta * Vector2(scroll_speed, scroll_speed)

	if sprite.region_rect.position >= Vector2(64, 64):
		sprite.region_rect.position = Vector2.ZERO

Hi,

so when the BG scene is added to the level its not scrolling?

in the level scene, is the script still showing as attached?
if it is, when you highlight the BG node, does it have a value other than 0 in the inspector?

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.

Privacy & Terms