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