_customSprite = new cc.Sprite().
Here the code of all cocos2d Layer:
var SpineLayer = cc.Layer.extend({
_customSprite : null,
_skeleton : null,
ctor:function () {
this._super();
this._skeleton = sp.SkeletonAnimation.createWithJsonFile(res.spine_json, res.spine_atlas);
this._skeleton.setAnimation(0, 'walk', true);
this._skeleton.setSkin("default");
this._skeleton.setPosition(0, 0);
// my custom function, I run callback in CCSkeletonAnimation::update()
this._skeleton.addUpdateCallback(this.onSkeletonUpdate.bind(this));
this.addChild(this._skeleton);
this._customSprite = new cc.Sprite(res.test_png);
this.addChild(this._customSprite , 1);
},
onSkeletonUpdate:function () {
var slot = this._skeleton.findSlot("gun");
var position = new cc.Point(slot.bone.worldX, -slot.bone.worldY);
position = this._skeleton.convertToWorldSpace(position);
this._customSprite .setPosition(position);
}
})
Any ideas? Maybe some links to helpful posts? Or, maybe, someone can explain the function resize from here
spine-runtimes/index.html at master ?