In my script, I have my "Fisherman" scene instantiate a "Bait" scene on a marker2d as the Fisherman's child. In my Bait script, I have the bait moving down on direction.y. I understand that since it is a child, it will move relative to its parent; but how could I have it move independently? Here is the code to the Fisherman and Bait:
#Make a child move independently from it's parent
10 messages · Page 1 of 1 (latest)
You can have a scene tree like, or similar to
-World (node2d)
-Fisherman
-BaitNode (node2d)
So you can instantiate the Bait scene as a child of 'BaitNode' or have it as a sibling of the fisherman
To do this you can use signals, like the fisherman sends a signal that he's using the rod and a bait is created at the global position of the marker2d you use
Then the world can receive the signal and instantiate the bait as its child so the bait is sibling of the fisherman
Click on the node, in the inspector go to Visbility and enable Top Level
I forgot to mention that in the Level node, Fisherman is a child of a child of a Pathway node
I will try both of these!
Do I need to make a custom signal? How can I do this?
signal my_signal(param1, param2, ...)
You can use as many parameters as needed
if you don't need parameters, you can just omit the paranthese entirely
signal my_signal_without_params