From 0059b7b1965ee6416f0f7c53cccb31e26b173f3f Mon Sep 17 00:00:00 2001 From: Sebastian Morr Date: Wed, 18 Mar 2020 16:42:19 +0100 Subject: [PATCH] Beginnings of a force-directed layout --- main.gd | 2 +- node.gd | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/main.gd b/main.gd index c0001d3..908e8bc 100644 --- a/main.gd +++ b/main.gd @@ -40,7 +40,7 @@ func git(args, splitlines = false): var output = [] var a = args.split(" ") a.insert(0, "-C") - a.insert(1, "/home/seb/tmp/godotgit") + a.insert(1, "/home/seb/wip/wurst-day-ever") #print ("Running: ", a) OS.execute("git", a, true, output, true) var o = output[0] diff --git a/node.gd b/node.gd index d3082c7..bd3629f 100644 --- a/node.gd +++ b/node.gd @@ -12,7 +12,13 @@ func _ready(): pass func _process(delta): - pass + for c in children: + var other = get_node("..").objects[c] + var d = other.position.distance_to(position) + var dir = (other.position - position).normalized() + var f = ((d-400)*0.01) + position += dir*f + other.position -= dir*f func id_set(new_id): id = new_id