mirror of
https://github.com/Steffo99/hella-farm.git
synced 2024-11-26 01:54:23 +00:00
13 lines
330 B
GDScript3
13 lines
330 B
GDScript3
|
extends Camera2D
|
||
|
class_name GameCamera
|
||
|
|
||
|
|
||
|
## Get the first possible [GameCamera] instance by climbing the scene tree one ancestor at a time.
|
||
|
static func get_ancestor(start: Node) -> GameCamera:
|
||
|
var current = start
|
||
|
while current is Node:
|
||
|
if current is GameCamera:
|
||
|
return current
|
||
|
current = current.get_parent()
|
||
|
return null
|