我已经使用linkedlist在cocos2d-android游戏应用中显示了精灵,如果精灵被销毁了,它应该被永久销毁并移除,但是这个精灵消失了,又出现了,不知道如何永久移除精灵,有什么帮助吗?这是delete的代码。
for (CCSprite ship2 : shipsToDelete)
{
_ships2.remove(ship2);
removeChild(ship2, true);
}发布于 2013-06-15 17:21:41
LinkedHashMap<Object, Object> hashMap1;
LinkedHashMap<Object, Object> hashMap2 ;
for (Object key : hashMap1.keySet()) {
hashMap2.remove(key);
} for (CCSprite ship2 : shipsToDelete){
if(_ships2.contains(ship2){
_ships2.remove(ship2);
removeChild(ship2, true);
}
}这只在_ships2 = shipsToDelete;时有效,但是_ships2,shipsToDelete中的项将被删除,我认为它不会在_ships2 = shipsToDelete.clone()时进入if子句,所以你必须使用喜欢的哈希图或精确的对象引用。
发布于 2013-07-29 19:00:30
在析构函数调用函数中。
CC_SAFE_RELEASE(_object);https://stackoverflow.com/questions/17122046
复制相似问题