From 814caca3825a499c93fb145c60d78bab0512a699 Mon Sep 17 00:00:00 2001 From: Sebastian Morr Date: Thu, 29 Oct 2020 16:06:38 +0100 Subject: [PATCH] Make single HEAD float to the center --- scenes/arrow.gd | 8 ++++---- scenes/repository.gd | 4 +++- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/scenes/arrow.gd b/scenes/arrow.gd index a54d8fd..29a33da 100644 --- a/scenes/arrow.gd +++ b/scenes/arrow.gd @@ -14,10 +14,6 @@ func _process(_delta): if not (repository and repository.objects.has(source)): return - if repository.objects[source].type == "head": - $Tip.hide() - $Line.hide() - var start = repository.objects[source].position var end = start + Vector2(0, 60) @@ -40,3 +36,7 @@ func _process(_delta): $Line.points[1] -= $Line.points[1].normalized()*30 $Tip.position = $Line.points[1] $Tip.rotation = PI+$Line.points[0].angle_to($Line.points[1]) + + if repository.objects[source].type == "head": + $Tip.hide() + $Line.hide() diff --git a/scenes/repository.gd b/scenes/repository.gd index 16ad07a..f72ffb8 100644 --- a/scenes/repository.gd +++ b/scenes/repository.gd @@ -164,7 +164,9 @@ func update_refs(): func apply_forces(): for o in objects.values(): - if not o.visible or o.type == "head": + if not o.visible: + continue + if o.type == "head" and o.children.size() > 0 and objects.has(o.children.keys()[0]): continue for o2 in objects.values(): if o == o2 or not o2.visible or o2.type == "head":