If you wanna build something similar, it's basically a RayCast (Godot4) that sets the endpoint of a Line2D (Godot4). Its pretty simple but effective. :DAnd the corner issue - well - thats for the difficulty!