What I want to do is have scenes for characters, for example, that are constructed piece by piece.
What I mean is that I could add an animation child node, or sprite, or even other nodes which give some behavior to my base node (for instance I implemented several “navigation” nodes - InputNavigation, AimlessNavigation, FollowNavigation, etc. - that I can just append to a node and they do their thing).
I’m stuck at sprites. I have a sprite component (node) that I can drop on a node, and get the parent’s sprite id, like so
func _ready() -> void:
var id = get_parent().sprite_id
texture = ResourceManager.get_character_frames(id)
Currently the parent script actually exports the sprite_id
, but what if I want another type of node (like an object, not a character) to have a sprite? I’d have to export the sprite_id
there too.
And this is a simple example, what if I want a behavior that will add even more code to the parent component, that will then have to be duplicated in some other type of node where I want the same behavior?
The problem is that these child nodes can’t export properties themselves, and they can’t make the parent export them either. So all the stuff I want to expose in the inspector has to be in the parent script, where I can’t just extend MovingBodyComponent, SpriteComponent, etc.
.
What is the godot way for this?