Cropping a sprite at run time

Well I am facing 2 issues which are similar I guess.

  1. I have a candy which when the user presses the eat button, I want 10% of the top image to be cropped each time.
  2. I have a candy on which where ever the user clicks, I want to remove some portion of the candy. The portion should have rough edges and and should be the area where the user clicks.

I think it has something to do with ClippingNode but I would appreciate if someone could give me an example.

Thank you.

I think you can use CCSprite::setTextureRect(CCRect).

Can you explain what values will go in CCRect parameter? e.g. the size of the sprite is 480x800. So if enter this value CCRect(0,0,480,600), it will remove 200px from the top? And will the position of the sprite change?

Best way to learn is to try it yourself.