I did a similar thing with a missile launcher shooting at a space ship when it entered an area2d, like this:
func _on_Radar_body_entered(body: Node) -> void: when the ship enters I set a
true to say it can be shot at.
func _on_Radar_body_exited(body: Node) -> void: when the ship leaves I set the
false, so it can't be shot at.
Then in the
_process function, if the
true, shoot the ship.