0
votes

I'm new to cocos2d and my game situation is below. In top-down shooter game i want to paint dead enemy corpses on top of the background. I use CCTMXTileMap for background so I suppose that corpses should draw on the same CCLayer that is higher on Z-index. But I dont want corpses to be children of the CCLayer, cuz i will never update them lying down and it would be a waste of resources which will be critical at a greater quantity of corpses. So my question is how to add the texture from (enemyAfterDeath sprite) CCNode to the (corpsesLayer) CCLayer once and forget about it. So these textures would be adding over time to One Big CCLayer and its Big Texture would be changing on each add. Sorry for my poor English. Thanks in advance!

1

1 Answers

1
votes

I think you need to take a loook at CCRenderTexture. You will basically do something like so:

CCRenderTexture* myRenderedTextureNode = [CCRenderTexture node];

[myRenderedTextureNode begin];
[enemySprite visit];
[myRenderedTextureNode end];

Look for the RenderTextureTest.m demo on your cocos2d folder. It should be pretty easy.