"Scratch-in" Effect

"Scratch-in" Effect
0.0 0


I have been trying to create scratch-in effect i.e to produce image out of transparent part. Kind of the opposite of what is being done in the following link.

I was actually looking for scratch-off effect so i came across this link but now i also need the opposite of it. Any help would be appreciated.
I want to create image out of transparent part when i scratch/rub touch on it.Please do tell me if i am not clear enough.

Another issue i was facing is that if i run an action like CCMove or CCRotate on the sprite i.e.scratchLayer, it does not move. Could anyone tell me a way to runactions on it as well?

If this issue has been resolved in another thread or site kindly redirect me to that. Countless hours of googling only got me to the above link
And i am also unaware of open gl. So the scratch-off effect was recreated mostly by hit and trial.:slight_smile:


You need to post more details, I certainly cannot help without some source code or screenshots.


I am able to produce the following effect.

This where i create sprites.

brush = control~~>loadFromFrame; //this is custom class method to add sprites
ccBlendFunc blend = ;
ccBlendFunc blend2 = {GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA};
scratch = control~~>loadFromFrame; //this is custom class method to add sprites

This is my (void TestScene::ccTouchesMoved(CCSet* pTouches, CCEvent* event))

if(touch) {
tap = touch~~>getLocation;
glColorMask(1.0f, 1.0f, 1.0f, 1.0f);

The above code helps me achieve the effect shown in video. As soon as i touch, the above image is scratched(parts removed) and the background is shown. This might not be the accurate way but does the job for me.

But now i want to acheive the opposite of it.
I want to start off with the background screen and as soon as i move/touch areas, image should pop out where i touch.

And the scratch sprite also does not have any effect of runAction(CCRotateBy::create(1.0f,30)).
Hw can i run actions on this scratch sprite.
Any help is appreciated.


Anyone? :frowning: