title: How to remove a sprite permanently in Cocos2d-x
body: <p>I am developing a game using cocos2d-x. I want to remove sprites permanently. I have two sprites &amp; making collision between the sprites. When collision happens, i want to remove those sprites permanently. I am using the following code to making collision &amp; remove sprites.</p>
  
  <pre><code>CCARRAY_FOREACH(_sprrand24, stwentyfour)
  {
      CCSize size=sprrand24-&gt;getContentSize();            
      CCSprite *sprrand24 = dynamic_cast&lt;CCSprite*&gt;(stwentyfour);
      CCRect sprrand24Rect = CCRectMake( 
                                             sprrand24-&gt;getPosition().x - (size.width/2),
                                             sprrand24-&gt;getPosition().y - (size.height/2),
                                             size.width/2,
                                             size.height/2);
     CCARRAY_FOREACH(_sprrand25, stwentyfive)
     {
         CCSize size=sprrand25-&gt;getContentSize();
         CCSprite *sprrand25 = dynamic_cast&lt;CCSprite*&gt;(stwentyfive);
         CCRect sprrand25Rect = CCRectMake(
                                             sprrand25-&gt;getPosition().x - (size.width/2),
                                             sprrand25-&gt;getPosition().y - (size.height/2),
                                             size.width/2,  
                                             size.height/2);
  
     if (sprrand24Rect.intersectsRect(sprrand25Rect))
     {
      this-&gt;removeChild(sprrand24, true);
      this-&gt;removeChild(sprrand25, true);
     }
    }
  }
  </code></pre>