spineRunTime for cocos2dx v3 中动画播完删除animation
spineRunTime for cocos2dx v3 中删除animation,发现下面写法会崩溃:
spine::SkeletonAnimation* animationNode = spine::SkeletonAnimation::createWithFile("explosion/explosion.json", "explosion/explosion.atlas", 1);
animationNode->setAnimation(0, "animation", false);
animationNode->setPosition(ccp(x,y));
animationNode->setEndListener( [animationNode] (int trackIndex) {
//spTrackEntry* entry = spAnimationState_getCurrent(animationNode->getState(), trackIndex);
//const char* t_animationName = (entry && entry->animation) ? entry->animation->name : 0;
//string animationName=t_animationName==0?"":t_animationName;
//CCLOG("%d end: %s", trackIndex, animationName.c_str());
animationNode->removeFromParentAndCleanup(true);
});
于是只好通过加一个延迟来避免崩溃,下面是可用的写法:
spine::SkeletonAnimation* animationNode = spine::SkeletonAnimation::createWithFile("explosion/explosion.json", "explosion/explosion.atlas", 1);
animationNode->setAnimation(0, "animation", false);
animationNode->setPosition(ccp(x,y));
animationNode->setEndListener( [animationNode] (int trackIndex) {
//spTrackEntry* entry = spAnimationState_getCurrent(animationNode->getState(), trackIndex);
//const char* t_animationName = (entry && entry->animation) ? entry->animation->name : 0;
//string animationName=t_animationName==0?"":t_animationName;
//CCLOG("%d end: %s", trackIndex, animationName.c_str());
animationNode->runAction(CCSequence::create(CCDelayTime::create(0.01),CCRemoveSelf::create(),NULL));
});
或者用completeListener,仍然需要加延迟:
animationNode->setCompleteListener( [animationNode] (int trackIndex, int loopCount) {
//spTrackEntry* entry = spAnimationState_getCurrent(animationNode->getState(), trackIndex);
//const char* t_animationName = (entry && entry->animation) ? entry->animation->name : 0;
//string animationName=t_animationName==0?"":t_animationName;
//CCLOG("%d complete: %s %d", trackIndex, animationName.c_str(),loopCount);
animationNode->runAction(CCSequence::create(CCDelayTime::create(0.01),CCRemoveSelf::create(),NULL));
});
spineRunTime for cocos2dx v3 中动画播完删除animation的更多相关文章
- spineRuntTime for cocos2dx v3,attack播完后回到idle
spineRuntTime for cocos2dx v3,attack播完后回到idle. _animationNode = spine::SkeletonAnimation::createWith ...
- css3中动画(transition)和过渡(animation)详析
css3中动画(transition)和过渡(animation)详析
- [Cocos2d-x v3.x]序列帧动画
简单介绍 Cocos2d-x中.动画的详细内容是依靠精灵显示出来的,为了显示动态图片,我们须要不停切换精灵显示的内容.通过把静态的精灵变为动画播放器从而实现动画效果. 动画由帧组成,每一帧都是一个 ...
- Cocos2d-x Lua中帧动画
帧动画就是按一定时间间隔.一定的顺序.一帧一帧地显示帧图片.我们的美工要为精灵的运动绘制每一帧图片,因此帧动画会由很多帧组成,按照一定的顺序切换这些图片就可以了. 在Cocos2d-x Lua中播放帧 ...
- Cocos2d-x v3.11 中的新内存模型
Cocso2d-x v3.11 一项重点改进就是 JSB 新内存模型.这篇文章将专门介绍这项改进所带来的新研发体验和一些技术细节. 1. 成果 在 Cocos2d-x v3.11 之前的版本中,使用 ...
- 使用cocos2d-x v3.1开发小游戏(基本框架)
小游戏的组成 欢迎界面 在游戏资源未全部加载完之前就需要载入,避免进入游戏会有一段黑屏时间. 可以用来展示游戏名称或者开发者logo. 开始菜单界面 一般用于显示游戏名称和关卡选择(或者称游戏难度选择 ...
- Cocos2d-x v3.6制作射箭游戏(二)
原文 Cocos2d-x v3.6制作射箭游戏(二) 六 24, 2015by RENSHANin COCOS2D-X 上章我们创建并加载了游戏地图,接下来的两章我们将实现如下的效果. 在开始之前,先 ...
- cocos2dx v3.x lua绑定分析
打算新项目转到cocos2dx v3上了,下载代码浏览过后发现改动真是非常大,结构性调整很多. 比如tolua绑定这一块,就几乎全翻新了. 胶水代码的生成,改成了全自动式的,通过clang来分析c++ ...
- Cocos2d-x v3.1 Hello world程序(四)
Cocos2d-x v3.1 Hello world程序(四) 在上一篇文章中我们我们已经使用Cocos-Console工具生成了工程,本机生成的目录为:"D:\CocosProject\T ...
随机推荐
- wstring to wchar_t*
If you want to convert from std::wstring to const WCHAR* (i.e. the returned pointer gives read-onl ...
- sublime同步侧边栏与窗体的颜色
Ctrl+Shift+P -> install -> 搜索安装包 SyncedSidebarBg,自动同步侧边栏底色为编辑窗口底色. P.S. 有时改完后侧边栏颜色没变化,不知什么原因,打 ...
- 大型开放式网络课程MOOC的一点体会
2012年,美国的顶尖大学陆续设立网络学习平台,在网上提供免费课程,Coursera.Udacity.edX三大课程提供商的兴起.给很多其它学生提供了系统学习的可能.这就是大型开放式网 ...
- 【linux】重置fedora root密码
I forget root password on fedora,debian.fedora 17 fedora 18 fedora 19 fedora 20 fedora 21 fedora .de ...
- UITableViewAutomaticDimension
tableView.rowHeight = UITableViewAUtomaticDimension UITableViewAutomaticDimension is the default val ...
- rpm常用命令及rpm参数介绍
RPM是RedhatPackageManager的缩写,是由RedHat公司开发的软件包安装和管理程序,同Windows平台上的Uninstaller比较类似.使用RPM,用户可以自行安装和管理Lin ...
- spring mvc 图片上传,图片压缩、跨域解决、 按天生成文件夹 ,删除,限制为图片代码等相关配置
spring mvc 图片上传,跨域解决 按天生成文件夹 ,删除,限制为图片代码,等相关配置 fs.root=data/ #fs.root=/home/dev/fs/ #fs.root=D:/fs/ ...
- 错误:google-chrome-stable-44.0.2403.157-1.x86_64.rpm 的公钥没有安装
错误:google-chrome-stable-44.0.2403.157-1.x86_64.rpm 的公钥没有安装 Fedora22 系统更新软件包.出现: warning: /var/cache/ ...
- spring cloud学习地址
http://book.itmuch.com/1%20%E5%BE%AE%E6%9C%8D%E5%8A%A1%E7%AE%80%E4%BB%8B/1%20%E5%BE%AE%E6%9C%8D%E5%8 ...
- 去掉cb中括号的匹配
Settings->Editor->General settings->Indent options->Brace completion``