
this.sprite = new sp.SkeletonAnimation(res.jg_json, res.jg_atlas, 0.7);
this.sprite.setPosition(cc.p(size.width / 2, size.height / 2 - 150));
this.sprite.setMix('flying', 'playing', 100);
this.sprite.setMix('playing', 'flying', 0.2);
this.sprite.setAnimation(0, 'flying', true);
this.sprite.setAnimationListener(this, this.animationStateEvent);
this.sprite.setScale(0.5);
this.addChild(this.sprite, 4);
this.sprite.setDebugSolots(true);
//
// var box=this.sprite.getBoundingBox();
// console.log(box);
//var log_img=this.sprite.getAttachment("logo","logo");
// console.log(log_img);
// //log_img.setScale(2,3);
// log_img.setScale(100,100);
// var logo= this.sprite.findSlot("logo");
//console.log(this.sprite);
// console.log(logo); 有返回对象
【其实我对Slot这个东东概念还是很模糊,当我控制对象里面的数据时候,确实有对游戏的那个皮产生了影响,我改了他的颜色r- g- b- 后的三个数值,发现蒙皮颜色会产生变化。
至于其它作用 还没有发现
】
// var logo= this.sprite.findBone("logo");
// console.log(logo); 返回为NULL
```
例如此处有不断动画的傻龙一只,在游戏过程中 假设游戏中只有攻击头部区域才会有效,那么做碰撞检测就需要获取到头部的Boundbox。
也许有一个方案就是估算出头部距离Spine的锚点,然后计算出头部大概在真个区域的那个位置来做碰撞计算。
但是如果头部是不停摆动的 或者做着各种乱七八糟动作的情况下,这种方式就不精确了。
我是想是否有方法获取到骨骼绑定的图片/渲染区域 的大小。这样就可以更好的实现游戏功能。