How to set up spines in cocos2d-x js

So I’ve created a simple walk cycle in Cocos Studio and wanted to add it to my code.

var HelloWorldLayer = cc.Layer.extend({
sprite:null,
ctor:function () {
    this._super();
    var size = cc.winSize;
    var sp = sp || {};
    var gary = new sp.SkeletonAnimation('res/skeletons/gary/gary.json', 'res/skeletons/gary/gary.atlas');
    this.addChild(gary, 4);
    return true;
}});

But this is saying that sp is undefined? What is sp? How do I create it? Looking at the SpineTest.js file didn’t help either. What do I do to fix this?

1 Like
"modules": ["cocos2d", "spine"],

Add “spine” to “modules” in your project.json if “extensions” alone isn’t providing much joy.

2 Likes

Perfect. Thank you!