You made the boomerang node to not be a child of the player node? You very much should already do it.
You also will need to add a timer, for a different purpose though.
You could make a global variable in player node, a simple boolean like is_boomerang_ready
, set by default to true
.
Anytime you press the Boomerang release button⢠it will first of all check if is_boomerang_ready
is true, boomerang gets released - you set is_boomerang_ready
to false.
Somewhere in _physics_process
there has to be a function to check if the boomerang has returned, let's call it has_boomerang_returned()
. A simple way to do it is to check if it's position is equal to player node's position, maybe with some room for error too?
Obviously there has to be a certain amount of time between you throwing, and checking if it's back already. You will have to start a timer at the throw, which will make has_boomerang_returned()
executable.
Feel free to ask for any clarifications, some people might even want to make that script for you.