代码如下,但是不能旋转
<pre class="brush:js; toolbar: true; auto-links: false;">var HelloWorldLayer = cc.Layer.extend({
sprite:null,
ctor:function () {
//////////////////////////////
// 1. super init first
this._super();
var size = cc.winSize;
var spineBoy = new sp.SkeletonAnimation('res/spineboy.json', 'res/spineboy.atlas');
spineBoy.setPosition(cc.p(size.width / 2, size.height / 2 - 150));
spineBoy.setAnimation(2, 'walk', true);
this.head = spineBoy.findBone("head");
spineBoy.setScale(1);
this.addChild(spineBoy, 4);
this._spineboy = spineBoy;
this.scheduleUpdate();
return true;
},
update:function(dt){
this.head.rotation += 2;
this._spineboy.updateWorldTransform();
}
});
官方的spine例子实在太简单了,吐槽一下。