So, i’ve tried lot of variations ComponentJS usage and js styles, but it just isn’t works.
It crushes on GetNewType, NewObjectWithGivenProto, JS_GetClass and etc.
I have working model on 3.9, but lot of things changed - It isn’t works on 3.15
Is someone have working example for 3.15?
…
So, i’ve tried simple
test = cc.ComponentJS.extend({
// add a new enemy every second
onEnter: function() {
cc.log("enter");
},
onAdd:function(){
cc.log("add");
},
onInit:function(){
cc.log("init");
},
update: function(dt) {
cc.log("update");
},
});
and it works fine in js itself:
var sc = new cc.Scene();
cc.director.runScene(sc);
var sceneJSComponent = new cc.ComponentJS("src/testScene.js");
sceneJSComponent.setName("sceneJSComponent");
sc.addComponent(sceneJSComponent);
but crushes in
auto c = ComponentJS::create("src/testScene.js");