extends Node @export var speed : float @export var velocity_dampening : float var target_velocity : Vector2 var velocity : Vector2 # Called when the node enters the scene tree for the first time. func _ready(): pass # Replace with function body. # Called every frame. 'delta' is the elapsed time since the previous frame. func _process(delta): var input : Vector2 = Input.get_vector("left", "right", "up", "down") target_velocity = input * delta * speed if input != Vector2.ZERO: velocity = velocity.lerp(target_velocity, velocity_dampening * 2) else: velocity = velocity.lerp(target_velocity, velocity_dampening) $"..".position += velocity