Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In my cocos2d-iphone game, I have 2 backgrounds (CCnodes), each containing a quite complex hierarchy of sprites.

I would like to make a smooth transition between them:

  • Initially, only the first background is visible
  • At the end, only the second one is visible

Is there a good way to set the opacity of a full hierarchy of sprites ?

I tried to recursively set the opacity of all the contained sprites. It kinda works except that:

  • I guess it's not very efficient
  • I would like the opacity of overlapping sprites to be 'merged' (as if the background was one single big sprite)
share|improve this question
You can render one node to a texture and render a sprite containing that texture some transparency on top of the other node – rraallvv Jan 8 '13 at 4:40
But what if I have animations running on the children (translations, scaling,...) – fiddler Jan 8 '13 at 7:26
wouldn't be any problem, all children would be rendered to the texture as normal. please see this related question – rraallvv Jan 9 '13 at 0:20
up vote 1 down vote accepted

I finally solved it using a CCRenderTexture.

You can find the detailed explanation here:

share|improve this answer
The link is dead. But I found another one right here: – Neon Warge Jun 22 '15 at 2:29
@NeonWarge Thanks, I just updated the link. – fiddler Jun 22 '15 at 5:24

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.