如何在cocos2d android中永久删除精灵

如何在cocos2d android中永久删除精灵,android,cocos2d-x,cocos2d-android,Android,Cocos2d X,Cocos2d Android,我使用linkedlist在cocos2d android游戏应用程序中显示精灵,如果精灵被销毁,它应该被永久销毁并删除,但该精灵消失并再次出现,不知道如何永久删除精灵,有帮助吗? 这是删除的代码 for (CCSprite ship2 : shipsToDelete) { _ships2.remove(ship2); removeChild(ship2, true); } 只有当\u ships2=shipsToDelete 但是来自

我使用linkedlist在cocos2d android游戏应用程序中显示精灵,如果精灵被销毁,它应该被永久销毁并删除,但该精灵消失并再次出现,不知道如何永久删除精灵,有帮助吗? 这是删除的代码

for (CCSprite ship2 : shipsToDelete)
    {
        _ships2.remove(ship2);
        removeChild(ship2, true);

        }
只有当
\u ships2=shipsToDelete

但是来自两个_ships2,shipsToDelete的项都将被删除,我想当
_ships2=shipsToDelete.clone()
时,它不会进入if子句,因此您必须在析构函数调用函数中使用类似的hashmap或精确的对象引用

CC_SAFE_RELEASE(_object);

谢谢你的回复,我已经用过像这样受保护的LinkedList\u ships2;在cocos2d中,任何对象的默认关键字都是CCSprite,那么我将如何使用上述代码呢@桑迪09
 for (CCSprite ship2 : shipsToDelete){
     if(_ships2.contains(ship2){ 
      _ships2.remove(ship2);
      removeChild(ship2, true);
     }
 }
CC_SAFE_RELEASE(_object);