'Pygame limiting collision targets

I'm looking for a solution to limit overlapping_sprites to objects of speciffing classes. My classes are: Ship, Missile1, Missile2, Asteroids, Space_junk.

I'm using simple loop:

if self.overlapping_sprites:
            for sprite in self.overlapping_sprites:
                sprite.die()
            self.die()

For now my code and knowledge knows how to create collisions with all those classes, but trying to connect Missile1 to impact only with Asteroids and Missile2 with Space_junk.

Btw Not sure how popular are livewires and overlapping_sprites method, so let me know, if I should also write it here.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source