Collision body not updating when 2 enemies are present

Godot Version

Running on Godot 4.2

Question

Hi guys im relatively new and im trying to make a hackandslash with companions as the main driver
Ive encountered a bug while testing yesterday and it seems like when an enemy is slain and another one is in the detection collision the companion collision just accepts the body exited signal and doesent seem to be detecting the other enemy in the detection area.
Tried combating this with a quick of and on switch of the collision upon an enemy exited. Im writing this from my phone atm will share the exact code later but the detection is something like this:

On enemy_dt_body exited(body)
If body.has_method(_enemy_character):
Enemy_in_range = false
$Enemy_dt/$collisionshape2d.disabled = true
Get_tree().create_timer(0.1).timeout
$Enemy_dt/$collisionshape2d.disabled = false
“Indent” if enemy_in_range ==false
“2×indent” $statechart.send_event(“enemy_clear”)

Thanks in advance for all answers.
Yall make my heart go doot <3

Got a video link working here:You make my heart go doot – Google Drive

Ok turns out im just stupid
I had to move the collision flip to after the state sevent signal and create an actual timer node under the area 2d

Thanks to everyone that took a look at my post <3

1 Like