Hey, guys,
I'm working on a predator-prey simulation for a school project.
The predator and prey nodes have a 2D area attached to them. If the predator's area touches the prey's area, the prey dies. For the reproduction simulation, I create instances of predators and prey every 1 second.
However, when I send the signal to delete the prey, only the original prey is deleted. The other instances seem to "ignore" the command.
Here is my code:
Predator script:
func _on_area_2d_area_entered(area):
if area.is_in_group("presas"):
print("O caçador encontrou uma presa")
hunt.emit()
Prey script
func _on_predador_hunt():
queue_free()