[CocosCreator]扑克翻牌效果
来源:互联网 发布:ubuntu拷贝文件 编辑:程序博客网 时间:2024/06/06 13:18
处理效果,勉强能用吧,我这只是提供个简单思路.
工程下载
1.创建空节点,添加mask组件,大小调整为扑克大小
2.添加精灵,到mask下
3.添加移动扑克的mask
4.添加移动精灵扑克
5.移动扑克为负的它自己的高度.
6.添加脚本,指认控件.
7.脚本代码
cc.Class({ extends: cc.Component, properties: { // foo: { // default: null, // The default value will be used only when the component attaching // to a node for the first time // url: cc.Texture2D, // optional, default is typeof default // serializable: true, // optional, default is true // visible: true, // optional, default is true // displayName: 'Foo', // optional // readonly: false, // optional, default is false // }, // ... m_ShowCard:cc.Sprite, m_ShowCardMask:cc.Node, m_BackCardMask:cc.Node, m_BackCard:cc.Node, }, ctor:function() { this.m_bMove = false; this.m_LastPos = 0; }, // use this for initialization onLoad: function () { this.node.on(cc.Node.EventType.TOUCH_START,this.onStart,this); this.node.on(cc.Node.EventType.TOUCH_END,this.onEnd,this); this.node.on(cc.Node.EventType.TOUCH_MOVE,this.onMove,this); }, onStart:function(event) { this.m_LastPos = event.touch.getLocation(); this.m_bMove = true; }, onEnd:function() { this.m_bMove = false; }, onMove:function(event) { var pos = event.touch.getLocation(); var y = pos.y - this.m_LastPos.y; this.m_LastPos = pos; this.m_ShowCard.node.y += y; this.m_ShowCardMask.y += y; this.m_BackCard.y -= y; this.m_BackCardMask.y += y; }, // called every frame, uncomment this function to activate update callback // update: function (dt) { // },});
阅读全文
0 0
- [CocosCreator]扑克翻牌效果
- 翻牌效果
- jquery图片翻牌效果
- ios 翻牌效果
- js实现翻牌效果
- NGUI实现翻牌效果
- 卡牌翻牌效果
- css3翻牌效果
- NGUI 翻牌效果
- css3实现翻牌效果
- jquery签到翻牌效果
- 纸牌翻牌效果
- cocos2d-lua翻牌效果
- FLEX翻牌图片展示效果.
- cocos2d 如何实现 翻牌效果
- CCSprite实现翻牌的效果
- cocos2dx卡牌翻牌效果
- cocos2dx卡牌翻牌效果
- python学习-Day11-12-复习
- 美团云召开首届人工智能峰会 生态成关键词
- AngularJS中的谷歌地图开发
- [zz系列]c语言的随机数
- 建设成为世界第五大经济体 破解阿里云生态密码
- [CocosCreator]扑克翻牌效果
- Fragment切换
- iOS面试:如何在平时工作中积累经验
- [微信小程序]计算自己手机到指定位置的距离
- leetcode 73. Set Matrix Zeroes
- 第九周项目3-利用二叉树遍历思想解决问题(2)
- MySQL 日期时间
- linux cut用法
- Map接口的使用注意事项