Hi,
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?
Thanks!
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);
layer->retain();
this->m_pParent->removeChildByTag(1,false);
unscheduleAllSelectors();
CCScene* sceneToTransitionTo = OpeningSequenceLogo::scene();
sceneToTransitionTo->addChild(layer,1);
CCScene* pScene = CCTransitionFade::transitionWithDuration(0.5f, sceneToTransitionTo);
if (pScene)
{
CCDirector::sharedDirector()->replaceScene(sceneToTransitionTo);
}
}
However, this doesn’t actually perform a transition, it just replaces the screen instantly. Any ideas on if this is possible?