在libGDX中使用Spine骨骼动画
2016-11-24 14:19
537 查看
在libGDX中使用Spine骨骼动画
首先,github是个宝库,实践流的读者可以直接看例子进行学习1.这是Spine官方给出的例子
https://github.com/EsotericSoftware/spine-superspineboy
2.我推荐这个,很棒的例子及使用合集
https://github.com/EsotericSoftware/spine-runtimes/tree/master/spine-libgdx
下面,我详细说明一下使用步骤:
首先是读取纹理地图集和骨骼数据,这些骨骼数据也包含动画状态数据.
TextureAtlas playerAtlas = new TextureAtlas(Gdx.files.internal(“spineboy/spineboy.atlas”));
SkeletonJson json = new SkeletonJson(playerAtlas);
SkeletonData playerSkeletonData = json.readSkeletonData(Gdx.files.internal(“spineboy/spineboy.json”));
AnimationStateData playerAnimationData = new AnimationStateData(playerSkeletonData);
然后需要一个spriteBatch和骨骼渲染对象.(如同tmx地图需要tmx渲染对象一样)
SpriteBatch batch = new SpriteBatch();
SkeletonRenderer skeletonRenderer = new SkeletonRenderer();
接着,用第一步读取的骨骼数据和动画状态数据创建一个骨骼和动画状态对象
Skeleton skeleton = new Skeleton(playerSkeletonData);
AnimationState animationState = new AnimationState(playerAnimationData);
获取动画的方式如下:
animationState.setAnimation(0, “walk”, true); // 序号, 动画名称, 循环
在每个update环节调用
animationState.update(delta);
animationState.apply(skeleton);
然后render:
batch.begin();
skeletonRenderer.draw(batch, skeleton);
batch.end();
转载链接:http://www.cnblogs.com/mignet/p/libGDX_Spine.html
相关文章推荐
- 使用spine骨骼动画制作的libgdx游戏
- 使用spine骨骼动画制作的libgdx游戏
- 在libGDX中使用Spine骨骼动画
- 在Unity3D中使用Spine2D的骨骼动画
- Cocosd使用骨骼动画Spine
- cocos2dx 使用spine制作骨骼动画
- cocos2dx 使用spine制作骨骼动画
- 使用Spine软件为骨骼动画制作简单特效
- 干货:使用Spine制作柔性的骨骼动画详解(DragonBones也能使用)
- HTML5骨骼动画Demo | 使用min2d、createjs、pixi播放spine动画
- spine基础以及骨骼动画的使用(1)
- 2D骨骼动画软件spine与在unity3d中使用
- Cocos2dx使用spine骨骼动画导致在iphone6s、iphone7真机闪退的解决办法
- 使用Spine来完成骨骼动画
- 骨骼动画 Spine的使用(With Cocos2d-x)
- 使用Spine软件制作骨骼动画供Cocos2d-x使用
- 在Unity3D中使用Spine2D的骨骼动画
- Cocos2dx使用spine骨骼动画导致在iphone6s、iphone7真机闪退的解决办法
- 使用 CocoStudio 创建 Cocos2d-x 序列帧和骨骼动画
- 逆天的骨骼动画工具 Spine 把2D画皮3D网格化。