How do i make this last movement based attack work with a joystick

im a beginner programmer following a tutorial on a “vampire survivors clone by Branno” on Youtube and are trying to turn it into a mobile app/game for a school group project. I am using a joystick made by MarcoFazio from the AssetLib, the tornado attack works by following the last movement input pressed by the player, it works on a keyboard but not when i use the joystick i added, I need help making it work with the joystick by making the tornado move towards the last movement direction when the timer ends , help will be apreciated. here are the code for the Tornado, and the joystick.

TORNADO

var move_to_less = Vector2.ZERO
var move_to_more = Vector2.ZERO
match last_movement:
	Vector2.UP, Vector2.DOWN:
		move_to_less = global_position + Vector2(randf_range(-1,-0.25), last_movement.y)*500
		move_to_more = global_position + Vector2(randf_range(0.25,1), last_movement.y)*500
	Vector2.RIGHT, Vector2.LEFT:
		move_to_less = global_position + Vector2(last_movement.x, randf_range(-1,-0.25))*500
		move_to_more = global_position + Vector2(last_movement.x, randf_range(0.25,1))*500
	Vector2(1,1), Vector2(-1,-1), Vector2(1,-1), Vector2(-1,1):
		move_to_less = global_position + Vector2(last_movement.x, last_movement.y * randf_range(0,0.75))*500
		move_to_more = global_position + Vector2(last_movement.x * randf_range(0,0.75), last_movement.y)*500

angle_less = global_position.direction_to(move_to_less)
angle_more = global_position.direction_to(move_to_more)

JOYSTICK

func _is_point_inside_joystick_area(point: Vector2) → bool:
var x: bool = point.x >= global_position.x and point.x <= global_position.x + (size.x * get_global_transform_with_canvas().get_scale().x)
var y: bool = point.y >= global_position.y and point.y <= global_position.y + (size.y * get_global_transform_with_canvas().get_scale().y)
return x and y

func _get_base_radius() → Vector2:
return _base.size * _base.get_global_transform_with_canvas().get_scale() / 2

func _is_point_inside_base(point: Vector2) → bool:
var _base_radius = _get_base_radius()
var center : Vector2 = _base.global_position + _base_radius
var vector : Vector2 = point - center
if vector.length_squared() <= _base_radius.x * _base_radius.x:
return true
else:
return false

func _update_joystick(touch_position: Vector2) → void:
var _base_radius = _get_base_radius()
var center : Vector2 = _base.global_position + _base_radius
var vector : Vector2 = touch_position - center
vector = vector.limit_length(clampzone_size)

if joystick_mode == Joystick_mode.FOLLOWING and touch_position.distance_to(center) > clampzone_size:
	_move_base(touch_position - vector)

_move_tip(center + vector)

if vector.length_squared() > deadzone_size * deadzone_size:
	is_pressed = true
	output = (vector - (vector.normalized() * deadzone_size)) / (clampzone_size - deadzone_size)
else:
	is_pressed = false
	output = Vector2.ZERO

if use_input_actions:
	# Release actions
	if output.x >= 0 and Input.is_action_pressed(action_left):
		Input.action_release(action_left)
	if output.x <= 0 and Input.is_action_pressed(action_right):
		Input.action_release(action_right)
	if output.y >= 0 and Input.is_action_pressed(action_up):
		Input.action_release(action_up)
	if output.y <= 0 and Input.is_action_pressed(action_down):
		Input.action_release(action_down)
	# Press actions
	if output.x < 0:
		Input.action_press(action_left, -output.x)
	if output.x > 0:
		Input.action_press(action_right, output.x)
	if output.y < 0:
		Input.action_press(action_up, -output.y)
	if output.y > 0:
		Input.action_press(action_down, output.y)
func _reset():
is_pressed = false
output = Vector2.ZERO
_touch_index = -1
_tip.modulate = _default_color
_base.position = _base_default_position
_tip.position = _tip_default_position
# Release actions
if use_input_actions:
for action in [action_left, action_right, action_down, action_up]:
if Input.is_action_pressed(action):
Input.action_release(action)

I recommend making it more modular and posting only the relevant part of the code.

As per the suggestion of artemisia i think this is the relevant codes
Tornado

var move_to_less = Vector2.ZERO
	var move_to_more = Vector2.ZERO
	match last_movement:
		Vector2.UP, Vector2.DOWN:
			move_to_less = global_position + Vector2(randf_range(-1,-0.25), last_movement.y)*500
			move_to_more = global_position + Vector2(randf_range(0.25,1), last_movement.y)*500
		Vector2.RIGHT, Vector2.LEFT:
			move_to_less = global_position + Vector2(last_movement.x, randf_range(-1,-0.25))*500
			move_to_more = global_position + Vector2(last_movement.x, randf_range(0.25,1))*500
		Vector2(1,1), Vector2(-1,-1), Vector2(1,-1), Vector2(-1,1):
			move_to_less = global_position + Vector2(last_movement.x, last_movement.y * randf_range(0,0.75))*500
			move_to_more = global_position + Vector2(last_movement.x * randf_range(0,0.75), last_movement.y)*500

Joystick

func _update_joystick(touch_position: Vector2) -> void:
	var _base_radius = _get_base_radius()
	var center : Vector2 = _base.global_position + _base_radius
	var vector : Vector2 = touch_position - center
	vector = vector.limit_length(clampzone_size)
	
	if joystick_mode == Joystick_mode.FOLLOWING and touch_position.distance_to(center) > clampzone_size:
		_move_base(touch_position - vector)
	
	_move_tip(center + vector)
	
	if vector.length_squared() > deadzone_size * deadzone_size:
		is_pressed = true
		output = (vector - (vector.normalized() * deadzone_size)) / (clampzone_size - deadzone_size)
	else:
		is_pressed = false
		output = Vector2.ZERO
	
	if use_input_actions:
		# Release actions
		if output.x >= 0 and Input.is_action_pressed(action_left):
			Input.action_release(action_left)
		if output.x <= 0 and Input.is_action_pressed(action_right):
			Input.action_release(action_right)
		if output.y >= 0 and Input.is_action_pressed(action_up):
			Input.action_release(action_up)
		if output.y <= 0 and Input.is_action_pressed(action_down):
			Input.action_release(action_down)
		# Press actions
		if output.x < 0:
			Input.action_press(action_left, -output.x)
		if output.x > 0:
			Input.action_press(action_right, output.x)
		if output.y < 0:
			Input.action_press(action_up, -output.y)
		if output.y > 0:
			Input.action_press(action_down, output.y)```