Sharing sprites/layers across scenes?

Sharing sprites/layers across scenes?
0.0 0



In my game, I have several layers at the start that all have the same background and button positions. Right now, I’m using fade transitions to switch the scene, but every time I want to switch between layers, I end up making completely new scenes and adding the new layers and sprites onto that.

Is it possible to have a layer that keeps the same background and buttons across scenes and transitions? How would I do that? Or is it better to never change screens and I would have to a custom transition on the sprites themselves?



Okay I sort of came up with a way to do it. This works sort of:

void OpeningSequenceBlank::transitionToNextScene()
    CCNode* layer = this->m_pParent->getChildByTag(1);


    CCScene* sceneToTransitionTo = OpeningSequenceLogo::scene();

    CCScene* pScene = CCTransitionFade::transitionWithDuration(0.5f, sceneToTransitionTo);
    if (pScene)

However, this doesn’t actually perform a transition, it just replaces the screen instantly. Any ideas on if this is possible?