2024-04-14 03:38:04 +02:00
|
|
|
extends Node2D
|
|
|
|
class_name MainGame
|
|
|
|
|
|
|
|
|
|
|
|
## Get the first possible [MainGame] instance by climbing the scene tree one ancestor at a time.
|
2024-04-14 04:07:35 +02:00
|
|
|
static func get_ancestor(start: Node) -> MainGame:
|
2024-04-14 03:38:04 +02:00
|
|
|
var current = start
|
|
|
|
while current is Node:
|
|
|
|
if current is MainGame:
|
|
|
|
return current
|
|
|
|
current = current.get_parent()
|
2024-04-14 04:22:47 +02:00
|
|
|
Log.w(start, "MainGame ancestor not found.")
|
2024-04-14 03:38:04 +02:00
|
|
|
return null
|
|
|
|
|
|
|
|
|
|
|
|
@onready var gold_counter: Counter = $"GoldCounter"
|
2024-04-14 04:09:36 +02:00
|
|
|
@onready var camera: GameCamera = $"GameCamera"
|
2024-04-16 03:02:19 +02:00
|
|
|
@onready var default_spawn_parent: Node2D = %"DefaultSpawnParent"
|