Like the title says Im recreating the Wire Game from Among Us in Godot from scratch. With my limited knowledge Ive put this together:

And heres the Code:
extends Node2D
onready var pointer_line = $"White Line"
onready var pointer_lineB = $"Black Line"
var mouse_pos = Vector2()
var mx
var my
var global_pos
var gp
var line_white = false
var line_black = false
var select
var connected = false
var connectedB = false
var disable_white = false
var disable_black = false
var disable_Select_W = false
var disable_Select_B = false
var disable_Connected_W = false
var disable_Connected_B = false
func _ready():
pointer_line.add_point(Vector2(275,150))
pointer_lineB.add_point(Vector2(275,150))
func _physics_process(delta: float) -> void:
if disable_white== false:
if line_white == true:
if Input.is_action_pressed("click"):
mouse_pos = get_global_mouse_position()
global_pos = get_global_position()
mx = mouse_pos.x
gp = global_pos.x
my = mouse_pos.y
pointer_line.set_point_position(2,Vector2(mx,my))
if connected == false: # Point Reset When not Connected
if line_white == false:
pointer_line.set_point_position(2,Vector2(275,150))
if disable_black== false:
if linie_black == true:
if Input.is_action_pressed("click"):
mouse_pos = get_global_mouse_position()
global_pos = get_global_position()
mx = mouse_pos.x
gp = global_pos.x
my = mouse_pos.y
pointer_lineB.set_point_position(2,Vector2(mx,my-480))
if connectedB == false: # Point Reset When not Connected
if line_black == false:
pointer_lineB.set_point_position(2,Vector2(275,150))
func _on_Select_White_Cable_input_event(viewport, event, shape_idx):
if disable_Select_W == false:
if event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT:
if event.is_pressed():
line_white = true
print("White Selected")
func _on_Dead_Zone_input_event(viewport, event, shape_idx):
if event is InputEventMouseButton:
line_white = false
line_black = false
print("Dead Zone")
func _on_Connected_White_Wire_mouse_entered():
if disable_Connected_W == false:
if Input.is_action_pressed("click"):
if line_white == true:
connected = true
disable_white= true
disable_Select_W = true
pointer_line.set_point_position(2,Vector2(1300,842))
disable_Connected_W = true
print("Connected W")
func _on_Select_Black_Cable_input_event(viewport, event, shape_idx):
if disable_Select_B == false:
if event is InputEventMouseButton:
if event.button_index == BUTTON_LEFT:
if event.is_pressed():
line_black = true
print("Black Selected")
func _on_Connected_Black_mouse_entered():
if disable_Connected_B == false:
if Input.is_action_pressed("click"):
if line_black == true:
connectedB = true
disable_black= true
disable_Select_B = true
pointer_lineB.set_point_position(2,Vector2(1300,-520))
disable_Connected_B = true
print("Connected B")
Problem is when I grab a line with the mouse and stretch it, there is a big offset from mouse to line.
Also when I play the scene there is a 50% probability that I cant grab a Line/Wire. Maybe clearing the cache helps but I dont know how.