mirror of
https://github.com/Steffo99/hella-farm.git
synced 2024-11-23 00:24:21 +00:00
16 lines
362 B
GDScript3
16 lines
362 B
GDScript3
|
extends Node2D
|
||
|
class_name MainGame
|
||
|
|
||
|
|
||
|
## Get the first possible [MainGame] instance by climbing the scene tree one ancestor at a time.
|
||
|
static func get_ancestor(start: Node):
|
||
|
var current = start
|
||
|
while current is Node:
|
||
|
if current is MainGame:
|
||
|
return current
|
||
|
current = current.get_parent()
|
||
|
return null
|
||
|
|
||
|
|
||
|
@onready var gold_counter: Counter = $"GoldCounter"
|