I'm trying to understand how to make Cocos Studio exported scenes run inside cocos2d js project. seems like there is no documentation at all. I tried to instantiate scene object in different ways
var scene = ccs.csLoader.createNode("res/MainScene.json");
// or
var scene = cc.load("res/MainScene.json");
//res/MainScene.json is declared in resources 100%
but scene variable always contains empty objects (node and action).
I debugged load
and createNode
methods with step into feature and found that there is no proper parsers for scene.
I've stuck and don't know where to go next.
Does anyone know for sure if Cocos Studio is compatible with Cocos 2d JS?
UPDATE here is the code I'm using to initialise the project
cc.game.onStart = function(){
cc.view.enableRetina(cc.sys.os === cc.sys.OS_IOS ? true : false);
cc.view.adjustViewPort(true);
cc.view.setDesignResolutionSize(960, 640, cc.ResolutionPolicy.SHOW_ALL);
resolution size
cc.view.resizeWithBrowserSize(true);
cc.LoaderScene.preload(g_resources, function () {
var scene = ccs.load("res/MainScene.json");
cc.director.runScene(scene.node);
}, this);
};
cc.game.run();
it's autogenerated by setup.py script, I just replaced Scene creation code with load from json. after var scene = line of code scene object is null or undefined