Attention | Topic was automatically imported from the old Question2Answer platform. | |
Asked By | da_dev |
So, I have a KinematicBody2D with Area2D and I use it to detect enemies who enter the detection radius of the body. Here’s the code for the signal:
func _on_Detection_area_body_entered(body):
enemy = body
Problem is that if there’s another body behind the first one it’ll react to it and enemy will be equal to the new body. I still want to detect the first enemy, kill it and only then switch to the second one. I tried many other ways (this is the first one) and none of them work.
Any idea how to do it?