I want to make a Bubble Shooter style work with Godot Engine 4.3 and I need to draw a virtual line during launch. First, I created the RayCast2D node and added 2 Line2Ds as “LineOne and LineTwo” as its child nodes. Then, when I targeted this virtual line to objects, I wanted the objects to get the color I assigned to their IDs. Now the things I targeted with the code I gave below are working correctly, but the virtual line “LineTwo” is working, but this code cannot get the color of the targeted object with “dl.default_color = get_collider().color” and also “dl.points[1].x = vector_line_length” with this code, the virtual line does not end after reaching the targeted object. These two lines of code are not working in my project. How can I solve this correctly? Thank you for your help.

My Codes:

extends RayCast2D
@onready var vl = $LineOne
@onready var dl = $LineTwo
var vector_line_length = 600
@onready var manager = $"../Manager"
var default_color: Color = Color(0.388,0.643,0.969,1)

func _physics_process(_delta: float) -> void:
	
	if not $"../Shoot”.was_shooted:

		vl.visible = true
		dl.visible = true

		if $"../Shoot”.can_be_shot:
			look_at(get_global_mouse_position())

		if is_colliding():
			if not manager.items.has(get_collider()):
				var collision_point = to_local(get_collision_point())
				vl.default_color = default_color
				dl.default_color = default_color
				vl.points[1].x = collision_point.x
				dl.position = collision_point
				dl.rotation_degrees = (rotation_degrees * 2) * -1
				dl.visible = true
			else:
				var collision_point = to_local(get_collision_point())
				if get_collider().color != null:
					vl.default_color = get_collider().color
					dl.default_color = get_collider().color
				else:
					vl.default_color = default_color
					dl.default_color = default_color
				vl.points[1].x = collision_point.x
				dl.visible = false
		else:
			vl.default_color = default_color
			vl.points[1].x = vector_line_length
			dl.points[1].x = vector_line_length
			
	else:
		vl.visible = false
		dl.visible = false