onLoad: function () {
//获取地平面的y轴坐标
this.groundY=this.ground.y+this.ground.heigh/2;
//生成一个新的星星
this.spawnNewStar()
},
spawnNewStar: function(){
//使用给定的模板在场景中生成一个新节点
var newStar=cc.instantiate(this.starPrefab);//将新增的节点添加到Canvas节点下面 this.node.addchild(newStar); //为星星设置一个随机位置 newStar.setPosition(this.getNewStarPosition());
},
浏览器卡在加载 提示
Uncaught TypeError: this.node.addchild is not a function
at Game.spawnNewStar (Game.js:47)
at Game.onLoad (Game.js:40)
at CCClass.eval [as _invoke] (eval at createInvokeImpl (component-scheduler.js:256),65)
at CCClass.invoke (component-scheduler.js:154)
at CCClass.activateNode (node-activator.js:227)
at cc_Scene._activate (CCScene.js:93)
at TheClass.runSceneImmediate (CCDirector.js:610)
at boot.js:378
at CCLoader. (CCAssetLibrary.js:244)
at CCLoader.js:253
帮忙看下怎么回事 按着教程做的
65)