25 lines
623 B
GDScript
25 lines
623 B
GDScript
extends Camera2D
|
|
|
|
var target : Node2D
|
|
@export var temp_segment : Node2D
|
|
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready() -> void:
|
|
pass # Replace with function body.
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta: float) -> void:
|
|
if (Input.is_action_just_pressed("test_switch_cam")):
|
|
if(target):
|
|
target = null
|
|
else:
|
|
target = temp_segment
|
|
|
|
if target:
|
|
# TODO FIX
|
|
position = lerp(position, target.position, 0.6 * delta)
|
|
zoom = lerp(zoom, Vector2(1,1),0.6 * delta)
|
|
else:
|
|
position = Vector2(0,0)
|
|
zoom = Vector2(0.05,0.05)
|