quick lua 使用spine骨骼动画
看下下面两个文件
<spine/SkeletonRenderer.h>
<spine/SkeletonAnimation.h>
1.lua中创建方法:
sp.SkeletonAnimation:create(‘xxx.json’,'xxx.atlas', 1)
实际上绑定过来的create 是createwithfile,可以参考 lua_cocos2dx_spine_manual.cpp
static void extendCCSkeletonAnimation(lua_State* L)
{
lua_pushstring(L, "sp.SkeletonAnimation");
lua_rawget(L, LUA_REGISTRYINDEX);
if (lua_istable(L,-))
{
tolua_function(L, "create", lua_cocos2dx_CCSkeletonAnimation_createWithFile);
tolua_function(L, "registerSpineEventHandler", tolua_Cocos2d_CCSkeletonAnimation_registerSpineEventHandler00);
tolua_function(L, "unregisterSpineEventHandler", tolua_Cocos2d_CCSkeletonAnimation_unregisterSpineEventHandler00);
tolua_function(L, "setBlendFunc", tolua_spine_SkeletoneAnimation_setBlendFunc);
tolua_function(L, "addAnimation", lua_cocos2dx_spine_SkeletonAnimation_addAnimation);
tolua_function(L, "setAnimation", lua_cocos2dx_spine_SkeletonAnimation_setAnimation);
tolua_function(L, "replaceImage", lua_cocos2dx_spine_SkeletonAnimation_replaceImage);
tolua_function(L, "getCustomBounds", lua_cocos2dx_spine_SkeletonAnimation_getCustomBounds);
}
lua_pop(L, ); /*Because sp.SkeletonAnimation:create creat a LuaSkeletonAnimation object,so we need use LuaSkeletonAnimation typename for g_luaType*/
std::string typeName = typeid(LuaSkeletonAnimation).name();
g_luaType[typeName] = "sp.SkeletonAnimation";
g_typeCast["SkeletonAnimation"] = "sp.SkeletonAnimation";
}
2.registerSpineEventHandler注册事件
SP_ANIMATION_START = 0
SP_ANIMATION_END = 1
SP_ANIMATION_COMPLETE = 2
SP_ANIMATION_EVENT = 3
3.setDebugBonesEnabled(true) spine在调试模式,可以看到骨头的长度,骨点的位置
4.setDebugSlotsEnabled(true);设置查看每个骨头绑定的图片的大小,会用矩形框显示出来
5.setMix 让两个动作之间更加;流畅。单向的,所以我们要相互设置。最后一个是过渡时间
self.aniNode2:setMix("move","idle",0.2)
self.aniNode2:setMix("idle","move",0.2)
6.setTimeScale(0.1)
默认是1.0 ,然后咱们可以设置动画播放的速度。比如人物的行走,美工做的时候,可以统一按照一个速度走。然后在程序里设置不同的速度。
7.换装(需要去学习)
(1)全部换装SetSkin
(2)局部换装
quick 3.3 "异步"加载Spine方案:http://blog.csdn.net/chenhaobright/article/details/44619633
quick lua 使用spine骨骼动画的更多相关文章
- 使用spine骨骼动画制作的libgdx游戏
(官网:www.libgdx.cn) Super Spineboy是一个使用Spine和libgdx开发的跨平台游戏(Windows,Mac,Linux),Spine是一个2D游戏动画工具.Super ...
- spine骨骼动画组件使用详解
1. spine骨骼动画工具 骨骼动画: 把动画打散, 通过工具,调骨骼的运动等来形成动画spine是一个非常流行的2D骨骼动画制作工具spine 动画美术人员导出3个文件: (1) .png文 ...
- 记录 Spine骨骼动画导入unity 步骤[unity3d 4.6.6版本 2d动画]
1:准备好unity使用Spine所需要的运行库,可到如下地址 https://github.com/EsotericSoftware/spine-runtimes/tree/master/spine ...
- 如何给spine骨骼动画挂载粒子特效
目的是要把粒子挂载到骨骼动画的某个一个部件上,其实最主要是找对位置. 预览效果,左手红火,右手蓝火,很炫吧:) //init bool HelloWorld::init() { /////////// ...
- 在libGDX中使用Spine骨骼动画
首先,github是个宝库,实践流的读者可以直接看例子进行学习 1.这是Spine官方给出的例子 https://github.com/EsotericSoftware/spine-superspin ...
- cocos2d-js 骨骼动画 3.10
近期使用了cocos动画中的骨骼动画,这里记录使用的两种方式(3.10版): 一.cocos自带的动画编辑器导出的动画 ccs.armatureDataManager.addArmatureFileI ...
- 解决Spine骨骼混合动画错乱问题
Spine是一个很好的制作2D骨骼动画的软件,其中提供的混合(mix)动画功能可以很柔和过度两个不同的动画,但在混合时期,稍有不善,非常容易出现各种错乱.在Spine2D骨骼动画群上,有人提出全K帧. ...
- HTML5骨骼动画Demo | 使用min2d、createjs、pixi播放spine动画
Spine做骨骼动画是比较流行的,使用起来可能相对复杂,但功能毕竟强大,所以市场占有率较大. 在unity.cocos2d.starling中使用spine已经很成熟了,而HTML5这一块可能刚刚起步 ...
- 集成骨骼动画Spine的几点经验
最近开始用cantk做些复杂的游戏,其中一个游戏的DragonBones骨骼动画的JSON文件就达600K,导出之后显示各种不正常,可能是太复杂了,有些方面达到了DragonBones的极限.拿到官方 ...
随机推荐
- yum只下载安装需要的rpm包
1.安装yum的插件yum-downloadonly yum -y install yum-downloadonly 2.使用 yum -y install somepackges --downloa ...
- log4j2.x 配置文件默认寻找顺序
Automatic Configuration Log4j has the ability to automatically configure itself during initializatio ...
- 数dp多少个0-n多少0-9
#include <bits/stdc++.h> using namespace std; const int N = 15; int n; int dp[N][N][N]; int a[ ...
- 找区间连续值(HDU5247)
找连续数 Time Limit: 2000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others)Total Submis ...
- poj 1176 Party Lamps
http://poj.org/problem?id=1176 Party Lamps Time Limit: 1000MS Memory Limit: 10000K Total Submissio ...
- struts一些实用常量配置_2015.01.04
- register_shutdown_function
脚本时常死掉,而且并不总是那么好看. 我们可不想给用户显示一个致命错误,又或者一个空白页(在display_errors设为off的情况下) . PHP中有一个叫做 register_shutdow ...
- sql存储过程传入ID集合,和临时表的使用
方式1: Declare @SQL NVarChar(max) set @SQL='select *from Loanee as a ApplicationID in ('+@Application ...
- 夺命雷公狗mongodb之----mongodb---3---比较操作符
$lt < less than 小于 $lte <= less than and equal 小于等于 $gt > greater than 大于 $gte ...
- 夺命雷公狗---Thinkphp----10之后台登录.注销一条龙
首先我们还是还是写一个控制器名字叫LoginController.class.php的控制器,首先来写一个code的方法来让验证码先显示出来: public function Code(){ //创建 ...
http://cn.cocos2d-x.org/article/index?type=cocos2d-x&url=/doc/cocos-docs-master/manual/framework/native/v3/spine/zh.md