I'm trying to add two partially overlapping sprites (png) on top of a multi-layered tilemap. When I add sprite 1 at a z above sprite 2, and then set the vertex of sprite 1 to below sprite 2. The alpha around sprite with the higher vertex but lower z order erases the sprite with the lower vertex and higher z order. How can I set up OpenGL to prevent this? Or is there another way of setting up overlapping sprites on different layers at mixed vertices? The animations are different so using a single SpriteSheet doesn't seem the way to go. Here is some sample code:
CCSprite *goldCoin1 = [CCSprite spriteWithFile:@"coinblue_00010.png"];
CCSprite *goldCoin2 = [CCSprite spriteWithFile:@"coinblue_00010.png"];
[map addChild:goldCoin1 z:10];
[map addChild:goldCoin2 z:9];
[goldCoin1 setPosition:ccp(710 ,1200)];
[goldCoin2 setPosition:ccp(730 ,1200)];
[goldCoin1 setVertexZ:-110];
[goldCoin2 setVertexZ:-100];
CCAnimation *animationCoin = [CCAnimation animationWithName:@"spinningCoinAlt" delay:animDelay];
for(int x=10;x<23;x++)
{
[animationCoin addFrameWithFilename:[NSString stringWithFormat:@"coinblue_000%2d.png", x]];
}
id coinLoop1 = [[CCRepeatForever actionWithAction:[CCAnimate actionWithAnimation:animationCoin]] retain];
id coinLoop2 = [[CCRepeatForever actionWithAction:[CCAnimate actionWithAnimation:animationCoin]] retain];
[goldCoin1 runAction: coinLoop1];
[goldCoin2 runAction: coinLoop2];
Thanks.