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

1

1

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

Plasmo answered 24/4, 2009 at 22:19 Comment(1)
This link may help cocos2d-iphone.org/forum/topic/7921Lammastide
U
1

The answer is here: http://www.cocos2d-iphone.org/forum/topic/7921#post-46394

But short answer: You have to override the draw method and resort to openGL methods.

I know this question is old, but it needs an answer anyway.

Uriiah answered 19/8, 2011 at 2:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.