I'm working on a kid's game with cocos2d, and one of the stages involves the user clearing sand/snow that is covering a box. Thus, I'm implementing an eraser tool based on what I've seen here: http://muhammedalee.wordpress.com/2012/09/21/erasing-pixels-from-ccrendertexture/. Basically, I have a pileSprite (a pile of sand) on which I initially call:
[renderTexture begin];
[pileSprite visit];
[renderTexture end];
so that it's rendered to the renderTexture. Then when the eraser is dragged over the sprite, I do:
[renderTexture begin];
[eraserSprite visit];
[renderTexture end];
I want to know when the entire pileSprite has been erased (opacity = 0) in order to trigger the completion of the task. I would probably call this checking method every ccTouchEnded. Am I supposed to go over all the pixels in the renderTexture's UIImage? Is there a way to iterate over a sprite's pixels and check whether each pixel is transparent? Would really appreciate any help. I've looked into this: How to get pixel data from a UIImage (Cocoa Touch) or CGImage (Core Graphics)? as well, but don't really know what values to set for count, xx, yy.