20 lines
537 B
GDScript
20 lines
537 B
GDScript
extends Camera2D
|
|
|
|
@export var target: Vector2 = Vector2.ZERO
|
|
# Called when the node enters the scene tree for the first time.
|
|
func _ready():
|
|
pass
|
|
|
|
|
|
# Called every frame. 'delta' is the elapsed time since the previous frame.
|
|
func _process(delta):
|
|
self.position = lerp(self.position, target, 0.8 * delta)
|
|
|
|
func set_target(facing: String):
|
|
if facing == "E" or facing == "SE" or facing == "NE":
|
|
target = Vector2(1600, 0)
|
|
elif facing == "W" or facing == "SW" or facing == "NW":
|
|
target = Vector2(-1600, 0)
|
|
else:
|
|
target=Vector2.ZERO
|