32 lines
816 B
GDScript
32 lines
816 B
GDScript
extends Camera2D
|
|
|
|
var target : Node2D
|
|
@export var temp_segment : Node2D
|
|
@export var snake_line : Line2D
|
|
|
|
# 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)
|
|
position = target.position
|
|
zoom = Vector2(1,1)
|
|
snake_line.modulate = Color(1,1,1,0.5)
|
|
z_index = 0
|
|
else:
|
|
position = Vector2(0,0)
|
|
zoom = Vector2(0.05,0.05)
|
|
snake_line.modulate = Color(1,1,1,1)
|
|
z_index = 1
|