extends Camera2D

@export var lana : Lana
@export var lerp_speed := 10

var target_pos : Vector2

func _ready() -> void:
	target_pos = lana.position

func _process(delta: float) -> void:
	#var screen_center : Vector2 = get_screen_center_position()
	var diff := lana.position.x - target_pos.x
	var screen_size := get_viewport_rect().size.x
	if abs(diff) > screen_size / 2:
		target_pos.x += screen_size * sign(diff)
		
	position.x = lerp(position.x, target_pos.x, lerp_speed*delta)
