mirror of
https://github.com/Steffo99/hella-farm.git
synced 2024-11-27 18:44:23 +00:00
11 lines
326 B
GDScript
11 lines
326 B
GDScript
class_name Traversal
|
|
|
|
|
|
## Get the first possible [MainGame] instance by climbing the scene tree one ancestor at a time.
|
|
static func get_ancestors(start: Node) -> Array[Node]:
|
|
var result: Array[Node] = []
|
|
var current = start
|
|
while current is Node:
|
|
result.push_back(current)
|
|
current = current.get_parent()
|
|
return result
|