Check if body is already colliding, as opposed to body_entered

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By JorensM

I have a Player node and Enemy node, and Player has an attack function

When the Player is_attacking flag is set to true, the game checks for collisions with Enemy nodes and acts accordingly. Currently the way I detect collision is using body_entered signal, but this doesn’t work well for my case, because the attack’s collisionshape will most likely already be colliding with the enemy when the attack function is called. So what I wanted to know, if there is some way to check for collision between two nodes, that is already occuring, as opposed to only when the body first enters the collision.

:bust_in_silhouette: Reply From: JorensM

Solution: I used the function get_overlapping_bodies()