14 lines
294 B
GDScript3
14 lines
294 B
GDScript3
|
extends Node
|
||
|
class_name TK_Controller
|
||
|
|
||
|
var _context: Node2D
|
||
|
|
||
|
func _enter_tree() -> void:
|
||
|
_context = _get_context()
|
||
|
|
||
|
func _get_context() -> Node:
|
||
|
var current := self.get_parent().get_parent()
|
||
|
while not current is TK_Context:
|
||
|
current = current.get_parent()
|
||
|
return current
|