1
Fork 0
mirror of https://github.com/Steffo99/hella-farm.git synced 2024-11-22 08:04:23 +00:00

Allow find_closest_target to find Draggables of any name

This commit is contained in:
Steffo 2024-04-20 02:23:45 +02:00
parent b222f9a7ff
commit 6d30d123d6
Signed by: steffo
GPG key ID: 5ADA3868646C3FC0

View file

@ -23,7 +23,7 @@ func find_closest_target() -> Draggable:
var min_distance: float = INF var min_distance: float = INF
var to_drag: Node = null var to_drag: Node = null
for body in bodies: for body in bodies:
for target in body.find_children("Draggable", "Draggable", false, false): for target in body.find_children("*", "Draggable", true, false):
var distance = position.distance_to(target.position) var distance = position.distance_to(target.position)
if distance < min_distance: if distance < min_distance:
min_distance = distance min_distance = distance