I want to delete the sprite or b2body. After that i am going to check if the object is available or not.
I have the following coding:
I have removed the object using the tag:
this->removeChildByTag(100,true) //this is not in update function
In update function:
if(node->getTag()==100)
{
CCLog("node is available");
}
Here i got issue "EXC_BAD_ACCESS (code=2, address=0x84)" in node->getTag() line.
Is there any wrong on this code?
Is any alternate way to handle to check the node or object?
Thanks in advance.
My guess is that previously, you called something like:
addChild(node);
This added the node to the container (your CCScene derived class). When you called
this->removeChildByTag(100,true);
the "node" instance was destroyed.
A better check would be something like:
CCSprite* pNode = (CCSprite*)getChildByTag(100);
if(pNode == NULL)
{ // This node is available
// Do something here...
}