extends ParallaxLayer export var speed := 20.0 var offset_x = 0.0 var last_camera_x = 0.0 func _ready(): last_camera_x = get_node("../../Camera2D").get_camera_position().x func _process(delta): motion_offset = Vector2(offset_x, 0) var new_camera_x = get_node("../../Camera2D").get_camera_position().x offset_x -= delta*speed + (new_camera_x - last_camera_x)*-2 last_camera_x = new_camera_x