主题在Cocos2d-android游戏中: 要删除与其他精灵发生冲突后的精灵,我已经使用了spriteRect函数,但是这并没有让精灵在相交后被删除,经过大量的谷歌搜索才知道,它应该从父被删除, 这里的代码如何从父项中删除精灵cocos2d-android
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);
“家长不能得到解决”的错误,我要去哪里错了,请能任何人都可以告诉
感谢你的回复:)仍然没有被删除@Sohaib –