我尝试写了一段代码,无效…
var url = cc.url.raw(“resources/BattleAnim/Archer/ArcherAttack.anim”);
this.node.getComponent(cc.Animation).addClip(url);
this.node.getComponent(cc.Animation).play(“Attack”);
求正确的addClip使用姿势!
我尝试写了一段代码,无效…
var url = cc.url.raw(“resources/BattleAnim/Archer/ArcherAttack.anim”);
this.node.getComponent(cc.Animation).addClip(url);
this.node.getComponent(cc.Animation).play(“Attack”);
求正确的addClip使用姿势!
已经解决,新的代码如下:
var node = this.node;
cc.loader.loadRes("BattleAnim/Archer/ArcherAttack", cc.AnimationClip, function (error, clips){
if (!error) {
node.getComponent(cc.Animation).addClip(clips);
}
});
this.node.getComponent(cc.Animation).play("ArcherAttack");