1
Fork 0
mirror of https://github.com/Steffo99/hella-farm.git synced 2024-11-29 03:24:23 +00:00
hella-farm/scenes/game/game_camera.gd

13 lines
330 B
GDScript3
Raw Normal View History

2024-04-14 02:07:18 +00:00
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