I have an Effect node consisting of Node2d
> Sprite
> AnimationPlayer
. This node kills itself once its animation ends.
When my Player node takes damage, I instance this Effect node, set its position to the position of the Player node, and add it as a child of the Player node.
I also have a knockback on my Player node, so that when taking damage, it moves in the appropriate direction.
The problem is that once my effect animation spawns, its position does not get updated with the player, so the player slides out from behind it during its knockback.
Ideally, I want it to move with my player. I thought it was enough just to add it as a child of the player node, but apparently not.
So, my question: How can I link the position of this effect node to that of my player?
I do NOT want to write a script in the effect node (for example, using_process()) which looks for the player and manually follows its position. I am also using this effect elsewhere, and thus don't want ad hoc code like this just for the player.