不知道怎么创建节点(代码实现)

我在编辑界面上面新建了一个精灵类 写了一个animation 然后在这个上面挂了一个脚本
cc.Class({
extends: cc.Component,
properties: {
default: null,
target: cc.Node, },

start: function () {
var animationComponent = this.getComponent(cc.Animation);
animationComponent.play(“ball”);
animationComponent.schedule(this.onDrop, 0.01);
const num = 100;
// for (let i = 0; i < num; i++) {
// const node = cc.instantiate(animationComponent);
// this.Layout.addChild(node);
// node.position = cc.p(200, 100);
// }
},

onDrop: function () { this.node.y += 1.0; },
});
下面这个for 循环想要新建很多动画类到舞台上但是报错217

https://docs.cocos.com/creator/manual/zh/scripting/create-destroy.html
文档里面创建节点可以用 但是之后怎么替换呢

上传中…


上传中…