Reputation: 109
I copied the code found here:
http://www.cocos2d-iphone.org/forum/topic/12557
To create a successful "scratch off" effect, i.e. when my burnsprite visits the top layer image it makes it transparent in the spot the burnsprite is in, revealing the bottom layer under it.
I want to do the opposite. I want the top layer to start off transparent and have it become visible in the spot the burnsprite visits.
Below I list what I've tried to do:
I changed the burnsprite blend function to {GL_ZERO, GL_ONE}
. I think this is the correct thing to do. I don't know if it works or not though because my top layer does not start off transparent.
I changed [topLayer clear:0.0f g:0.0f b:0.0f a:1.0f]
to [topLayer clear:0.0f g:0.0f b:0.0f a:0.0f]
and nothing happened. It was not transparent.
I then did topLayer.sprite.opacity = 0.0;
Then is seemed to be only partially transparent. Still not what I wanted.
Please help.
Upvotes: 0
Views: 364
Reputation: 11
Your desired scenario seems to be exactly the same as the "scratch-off" scenario, but where the "scratch" layer is below instead of above.
If you switch the layers, you will get the effect you desire.
Upvotes: 1