How to detect collisions for multiple objects of the same type?

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

I have a problem in detecting collisions in my game.
The game has an Enemy scene (kinematicbody2d) that has a function for creating collisionshape2d and assigning rectangle shape to it. I am using this function inside a Spawner scene to define multiple enemies with different properties as enemy texture (black, red, …), collision shape extents, power, speed, … etc.
What happens is when the bullet from the player misses the first enemy (eg. black one), the following black enemies can’t be killed (queue free from scene).
Any help?