1

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.

Community
  • 1
  • 1
Joe Chan
  • 171
  • 1
  • 7
  • Here's an [inline link] to [may help you](http://gamedev.stackexchange.com/questions/15191/is-there-a-good-way-to-get-pixel-perfect-collision-detection-in-xna) – lreddy Mar 27 '13 at 05:15

0 Answers0