棋牌游戏《扔番茄动画》 资源以及代码

棋牌游戏常见的扔翻墙动画,资源已经打包好了。效果图
代码实现:
void PlayAnimationManager::playAnimationFanqie(const std::string& plist, Vec2 positon, const int size, Node* node, const int life /*= -1*/) { auto frameCache = SpriteFrameCache::getInstance(); frameCache->addSpriteFramesWithFile(plist); auto sprite1 = Sprite::createWithSpriteFrameName("fanqie.png"); sprite1->setPosition(positon); node->addChild(sprite1); Vector<SpriteFrame*> mSprite; SpriteFrame* frame = NULL; char str[100] = { 0 }; for (int i = 1; i < size; i++) { sprintf(str, "fanqie_%d.png", i); frame = frameCache->spriteFrameByName(str); mSprite.pushBack(frame); } auto mAnimation2 = Animation::createWithSpriteFrames(mSprite, 0.15f); mAnimation2->setLoops(1);// mAnimation2->setRestoreOriginalFrame(true); auto mAnimate2 = Animate::create(mAnimation2); //sprite1->runAction(mAnimate2); ActionInterval* moveto = MoveTo::create(1.8f, Vec2(100, positon.y)); ActionInterval * fadeout1 = FadeOut::create(0.00f); auto action1 = Sequence::create(moveto, mAnimate2,fadeout1, NULL); sprite1->runAction(action1); }
调用时候:
PLAYANIMATIONMANAGER.playAnimationFanqie("animation/fanqie_effect.plist", Vec2(visibleSize.width / 2 + origin.x, visibleSize.height / 2 + origin.y), 13, this, -1);
其中
PLAYANIMATIONMANAGER 为PlayAnimationManager单例类的宏定义。。
PlayAnimationManager是我自己实现的一个单例类,里面包含很多的动画效果,调用的时候只需要调用一个具体的动画函数就可以了。
下载地址:链接:http://pan.baidu.com/s/1i4S8sdv 密码:axoq
本文作者:闭眼就天黑
文章标题: 棋牌游戏《扔番茄动画》 资源以及代码
本文地址:https://www.byjth.com/qpdev/111.html
版权声明:若无注明,本文皆为“闭眼就天黑专栏_技术博客_个人学习总结”原创,转载请保留文章出处。
本文地址:https://www.byjth.com/qpdev/111.html
版权声明:若无注明,本文皆为“闭眼就天黑专栏_技术博客_个人学习总结”原创,转载请保留文章出处。
相关文章
版权所有:《闭眼就天黑专栏_技术博客_个人学习总结》 => 《棋牌游戏《扔番茄动画》 资源以及代码》
本文地址:https://www.byjth.com/qpdev/111.html
除非注明,文章均为 《闭眼就天黑专栏_技术博客_个人学习总结》 原创,欢迎转载!转载请注明本文地址,谢谢。