Best way to transition between multiple Cocostudio defined scenes

703 views Asked by At

I'm designing a game that has to switch between multiple game scenes. Each scene has been created in cocostudio and is imported into the code as a json file as:

var obj = ccs.load(res.Symbols_json);
this.addChild(obj.node);

This works fine, however when I have to transition to some other scene and then back to the original scene I experience several different issues.

If I create a new instance of the scene I return to as:

returnToScene: function () {
  this.startScene = new startGameScene();
  cc.director.runScene(new cc.TransitionFade(1,this.startScene));
}

PNG files are not loaded properly and transparency is shown as solid white. If I however keep the old instance of the scene as:

returnToScene: function () {
  if (this.startScene == null)  this.startScene = new startGameScene();
  cc.director.runScene(new cc.TransitionFade(1,this.startScene));
}

then I have to manually reload all animations from the json file and all particle systems gets destroyed (as in they are still present but are not updated).

Have anyone else experienced anything similar? I've considered using pushScene and popScene instead of runScene but as far as I can tell it seems to be an outdated way of performing scene transitions.

0

There are 0 answers