First: you're instancing node in _ physics_process
: this is wrong, as this code is called 60 time/sec, spawning orphan instances.
It should be done in void Player :: Fire ()
, just before add_child()
. Otherwise you'll get memory leak.
Second: you defined a single variable magic_blast
, and (even being placed into void Player :: Fire ()
) you're reassigning it with each new instance.
It should be either local variable, array of instances or guarded instance/singleton. With proper cleanup. Or again: memory leak.
Third: to use set_position()
you should declare magic_blast as Node2D, Sprite, or whatever type it actually is, but not just Node
(which is generic and does not have such function).