翻牌动画
2016-01-31 23:07
169 查看
cocos2dx动画整理,陆续添加。
基于win7,vs2012,cocos2dx v3.9
1)翻牌动画
源码下载:https://yunpan.cn/crGs5R2NEu9DY
访问密码 d34f
基于win7,vs2012,cocos2dx v3.9
1)翻牌动画
<span style="white-space:pre"> </span>auto pokerFront = Sprite::create("poker_front.png"); pokerFront->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y)); this->addChild(pokerFront, 1, 100); pokerFront->setVisible(false); auto pokerBack = Sprite::create("poker_back.png"); pokerBack->setPosition(Vec2(visibleSize.width/2 + origin.x, visibleSize.height/2 + origin.y)); this->addChild(pokerBack, 1, 100); auto listener = EventListenerTouchOneByOne::create(); listener->setSwallowTouches(true); listener->onTouchBegan = [=](Touch* touch, Event* event) { auto target = static_cast<Sprite*>(event->getCurrentTarget()); Vec2 point = target->convertToNodeSpace(touch->getLocation()); Size s = target->getContentSize(); Rect rect = Rect(0, 0, s.width, s.height); if (rect.containsPoint(point)) { if (!pokerFront->isVisible() && m_actionFinished) { m_actionFinished = false; auto oc1 = OrbitCamera::create(1, 1, 0, 270, 90, 0, 0); auto ac1 = Sequence::create(Show::create(), oc1, nullptr); auto ta1 = TargetedAction::create(pokerFront, ac1); auto oc2 = OrbitCamera::create(1, 1, 0, 0, 90, 0, 0); pokerBack->runAction(Sequence::create(oc2, Hide::create(), ta1, CallFunc::create(CC_CALLBACK_0(HelloWorld::actionCallBack, this)), nullptr)); }else if (!pokerBack->isVisible() && m_actionFinished) { m_actionFinished = false; auto oc1 = OrbitCamera::create(1, 1, 0, 270, 90, 0, 0); auto ac1 = Sequence::create(Show::create(), oc1, nullptr); auto ta1 = TargetedAction::create(pokerBack, ac1); auto oc2 = OrbitCamera::create(1, 1, 0, 0, 90, 0, 0); pokerFront->runAction(Sequence::create(oc2, Hide::create(), ta1, CallFunc::create(CC_CALLBACK_0(HelloWorld::actionCallBack, this)), nullptr)); } return true; } return false; }; _eventDispatcher->addEventListenerWithSceneGraphPriority(listener, pokerBack); _eventDispatcher->addEventListenerWithSceneGraphPriority(listener->clone(), pokerFront);
源码下载:https://yunpan.cn/crGs5R2NEu9DY
访问密码 d34f
相关文章推荐
- C++ Primer Summary
- java 类 基础知识小总结
- 191 Number of 1 Bits
- JVM之GC参数整理
- Service 组件在新进程中的启动及在进程内的绑定过程
- hdu 2114 Calculate S(n)
- 【C#】31. LINQ 与 SQL 的抗争! 小议 NTILE() 和 自写的拓展函数
- day3 homework
- camp 没有搞的
- [Spring实战系列](3)开启Spring之门
- 理解 JMeter 聚合报告(Aggregate Report)
- ubuntu 下win7引导修复
- 多核程序设计的相关基础知识----以误差扩散算法为例
- 多核程序设计的相关基础知识----以误差扩散算法为例
- java JDK8 学习笔记——第11章 线程和并行API
- 只有2%的人会解吗? 利用程序来回答!
- 基于spring3.0 MVC框架的文件上传(源码+解析)
- JDBC在getConnection之前为什么要调用Class.forName(转)
- SQL Server ->> EXECUTE AS LOGIN/USER和Revert表达式
- day3 collections(counter(对字典的加工) 有序字典(orderedDict)默认字典(defaultdict))可命名元组(namedtuple)