u/GustaKowai

Image 1 — Trouble with bodies detection.
Image 2 — Trouble with bodies detection.
Image 3 — Trouble with bodies detection.
▲ 23 r/godot

Trouble with bodies detection.

I am making a game where I have a tower that, at the beggining of each round, gives shields to all other towers in its range.
To do that i got all overlaping bodies of the shield-area.
The tower can get all the bodies that was in the game before it was added, but any tower put after it is ignored.

I tried getting the bodies in two ways:
torres = get_overlapping_bodies()

and

func _on_body_entered(body: Node2D) -> void:
torres.append(body)
func _on_body_exited(body: Node2D) -> void:
torres.erase(body)

in both ways, the array "torres" just have the bodies added before the shield tower.

u/GustaKowai — 3 days ago