这是你的问题:
for enemy in all_sprites: gets_hit = pygame.sprite.spritecollideany(umb, all_sprites) if gets_hit: all_sprites.remove(enemy)
您正在遍历该组,如果有任何精灵冲突,则将其全部删除。
您不需要遍历整个组-
碰撞功能可以解决这一问题。您只需要使用spritecollide函数,该函数将一个sprite与一个group进行比较。该函数将返回冲突列表,并使用DOKILL标志自动删除它们:
gets_hit = pygame.sprite.spritecollide(umb, all_sprites, True)



