Hi all
I have a character shooting projectiles which is rate-limited. When these projectiles enter a 2D Body, it should decrease the health of the enemy until it dies. Problem is that not all projectiles are detected, only every third projectile is detected, like the below.
1 (detected) --> 2 (not detected) --> 3 (not detected) --> 4 (detected) --> etc....
Here is the code on the enemy's 2D body:
func _on_area_2d_body_entered(body):
if body.name == "Character":
body.taking_damage()
Game.lose_life()
elif body.name == "Projectile":
if health > 0:
health -= 1
body.queue_free()
else:
body.queue_free()
queue_free()
Any help appreciated.