I have a simple scene that contains a Sprite node as its root. The sprite node has a SamplePlayer2D as a child.
I am a bit confused about how to pass 'constructor' parameters to this Sprite node when instantiating it from inside another scene. If I use ...
var mySprite = preload("res://mySprite.scn").instance()
get_parent().add_child(mySprite)
... I seem to have no way to pass any parameters to the sprite's _init() function. if however I use...
var mySprite = preload("res://scripts/mySprite.gd")
mySprite.new(param_a, param_b)
get_parent().add_child(mySprite)
... then the sprite's child sample player is not created with it, as the whole packed scene has not been instantiated. I have a feeling I'm approaching the whole task the wrong way.