1
Fork 0
mirror of https://github.com/Steffo99/hella-farm.git synced 2024-11-25 17:44:24 +00:00
hella-farm/scenes/game/main_game.gd

18 lines
468 B
GDScript3
Raw Normal View History

2024-04-14 01:38:04 +00:00
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) -> MainGame:
2024-04-14 01:38:04 +00:00
var current = start
while current is Node:
if current is MainGame:
return current
current = current.get_parent()
2024-04-14 02:22:47 +00:00
Log.w(start, "MainGame ancestor not found.")
2024-04-14 01:38:04 +00:00
return null
@onready var gold_counter: Counter = $"GoldCounter"
@onready var camera: GameCamera = $"GameCamera"