FantasyRun/utils.gd
Matthew Welch 7819007b01 Add initial tile scenes
Update script to dynamically find paths to follow
2024-09-27 16:49:56 -07:00

18 lines
453 B
GDScript

extends Node
func find_first_node_of_type(node: Node, type: Variant):
for child in node.get_children():
if is_instance_of(child, type):
return child
return null
func get_nodes_of_class(node: Node, type: Variant) -> Array:
var nodes = []
for child in node.get_children(true):
if is_instance_of(child, type):
nodes.append(child)
elif child.get_child_count(true) > 0:
nodes.append_array(get_nodes_of_class(child, type))
return nodes