cocos js Spine sp.SkeletonAnimation

2234 ワード


                                                            
            simulator        
            cc.loader.load([".json",
            ".atlas"], 
            function () {
            var spineBoy = new sp.SkeletonAnimation('.json', '.atlas');
            spineBoy.setPosition(cc.visibleRect.width / 2, cc.visibleRect.height / 2);
            spineBoy.setAnimation(0, '    ', true);  
            this.addChild(spineBoy, 4);
            this._spineboy = spineBoy;
            spineBoy.setEndListener(function (traceIndex) { //         。           
                //cc.log("%d end.", traceIndex);
            });
            spineBoy.setCompleteListener(function (traceIndex, loopCount) { //       -- loopCount        traceIndex     
                //cc.log("%d complete: %d", traceIndex, loopCount);
            });
            spineBoy.setEventListener(function (traceIndex, event) {
                cc.log(traceIndex + " event: %s, %d, %f, %s", event.data.name, event.intValue, event.floatValue, event.stringValue);
            });
            }, this);