Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/azure/11.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Cocos2d iphone 如何在cocos2d android中从父级移除精灵_Cocos2d Iphone_Ccsprite_Removechild_Cocos2d Android - Fatal编程技术网

Cocos2d iphone 如何在cocos2d android中从父级移除精灵

Cocos2d iphone 如何在cocos2d android中从父级移除精灵,cocos2d-iphone,ccsprite,removechild,cocos2d-android,Cocos2d Iphone,Ccsprite,Removechild,Cocos2d Android,Cocos2d android游戏中的主题: 为了在与另一个精灵碰撞后删除该精灵,我使用了spriteRect函数,但这并不能使该精灵在intersect之后被删除,因为很多Google都知道它应该从父级删除, 这是密码 CGRect ship1Rect = CGRect.make(ship1.getPosition().x - (ship1.getContentSize().width/2), ship1.getPosition()

Cocos2d android游戏中的主题: 为了在与另一个精灵碰撞后删除该精灵,我使用了spriteRect函数,但这并不能使该精灵在intersect之后被删除,因为很多Google都知道它应该从父级删除, 这是密码

CGRect ship1Rect = CGRect.make(ship1.getPosition().x - (ship1.getContentSize().width/2),
                               ship1.getPosition().y - (ship1.getContentSize().height/2),
                               ship1.getContentSize().width,
                               ship1.getContentSize().height);
if (CGRect.intersects(targetRect, ship1Rect))
{        
    parent.removeChildByTag(17, true);
}
但是这里
parent.removeChildByTag(17,true)在这一行中,错误是“家长无法解决”错误,我哪里出错了?有人能告诉我吗

ship1.getParent().removeChild(ship1,true);

您只能使用 removeChild(ship1,真实); 代替 removeChildByTag(17,真)

ship1.getParent(). removeChildByTag(17,true);