I would like to create a inner class (potentialy a singleton) that works over a child of the current node. To do this in a clean way, I would like to initialize its members in a single statement. Even after reading a lot of forum and GDScript reference texts. I was unable to achieve my code goals. So, is it possible? If not, what would be the better approach?
Example
class VelocityObserver:
onready var velocity : Vector2 = (outer_scope).get_node("child_of_current_scope").speed
func display_speed():
print("Component X :+velocity.x)
Yet, my doubt creates one more question. Instances of VelocityObserver, in the above example, don't derive/inherit from outer class but prefix "." still seems to have a mean (compile and runs normally). In this case, is it refer to the global scope? To be more clear about what I want to mean, this next line
var velocity : Vector2 = .get_node( "child_of_current_scope" ).speed
makes sense to the compiler.
Thanks in advance