Possible to change the alpha value of certain pixels on iPhone?

Posted by emi1faber on Stack Overflow See other posts from Stack Overflow or by emi1faber
Published on 2009-04-24T22:19:33Z Indexed on 2010/04/04 2:03 UTC
Read the original article Hit count: 704

Is it possible to change just a portion of a Sprite's alpha in response to user interaction? A good example of what I mean is iFog or iSteam, where the user can wipe "steam" off the iPhone's screen. Swapping images out wouldn't be feasible due to the sheer number of possibilities where the user could touch and move...

For example, say you have a simple app that has a brick wall in the background that has graffiti on it, so there'd be two sprites, one of the brick wall, then one of the graffiti that has a higher z value than the brick wall. Then, based upon where the user touches (assuming their touch controls a sandblaster), some of the graffiti should be removed, but not all of it, which could be accomplished by changing the alpha value on a portion of the graffiti sprite. Is there any way to do this in cocos2d-iphone? Or, do I need to drop down into openGL, and if so, where would be a good place to start my search on how to accomplish this?

Ideally, I'd like to accomplish this on a cocos2d-iphone Sprite, but if it's not possible, where's the best place to start looking?

Thanks in advance, Ben

© Stack Overflow or respective owner

Related posts about iphone

Related posts about iphone-sdk