I have a very simple problem, but can't seem to find a definite answer. I'm making a game that uses the same static background in every single scene. Currently I simply added the background everywhere, but it sort of seems unnatural, makes some of scene transitions I want really painful to make and eventually I'd like to make an animated background which wouldn't reload with every scene change.
Is there a way to add the same node as a background of all the nodes other than creating a singleton which I'd need to add/remove during every transition? In other words, can the scenes have transparent background so I can push them over the background scene?
I know that CCScene
doesn't have setOpacity
and have seen that some guys advice using CCLayer
for scenes, but then CCDirector::pushScene
accepts CCScene
as the argument.
EDIT.
Ok, now I see that I probably misunderstood the CCLayer
solution.. does it mean that the only way of doing it is to change scenes to layers and then adding/removing them from the main scene?
If you one animating/static background and want everything else to change, i would suggest having using only 1 cocos2d-x Scene with your fancy background and all other layers (previously scene) and elements to this scene.
So, technically you would never ever have to transition from a screen .
But, if you find another solution somewhere, do post/share.