在ccTouchesBegan 用;boundingBox 判断是不是在操作英雄
2013-11-15 14:10
239 查看
Cocos2d-x by Example Beginner's Guide,第3章
在GameLayer.ccp中
GameLayer::ccTouchBegan()中
其中的boundingBox方法可以,确实玩家是否在操作英雄,见boundingBox()方法。
在GameLayer.ccp中
GameLayer::ccTouchBegan()中
for (int p = 0; p < 2; p++) { player = (GameSprite *) _players->objectAtIndex(p); if (player->boundingBox().containsPoint(tap)) { player->setTouch(touch); } }
其中的boundingBox方法可以,确实玩家是否在操作英雄,见boundingBox()方法。
CCRect CCNode::boundingBox() { CCRect rect = CCRectMake(0, 0, m_obContentSize.width, m_obContentSize.height); return CCRectApplyAffineTransform(rect, nodeToParentTransform()); }
相关文章推荐
- 字符串操作(人民币转成大写/全角字符转半角字符/去掉字符串中重复的子字符串/过滤常见特殊字符/反过滤特殊字符/判断是不是合法手机/字符串匹配的算法)
- tf.image.sample_distorted_bounding_box(含其他对图形的操作)
- 判断是不是Chrome浏览器
- 输入两颗二叉树A,B,判断B是不是A的子结构
- 字符串操作:判断相等、判断首尾、大小写转换
- 单链表三(判断一单链表是不是循环单链表)
- easyui里box基本操作
- 判断一个数是不是回文数
- 偷懒代码块之首次操作判断。
- 判断是不是第一次进入app
- 重要的是看他是不是英雄
- jquery判断类型是不是number类型的实例代码
- 判断十二星座——我的算法,大家看是不是比较简便
- 判断一个点是不是在三角形里面
- 判断一个年份是不是闰年,用函数的方法实现
- C#中判断一个字符串是不是包含非法字符
- 【面试题】剑指Offer-24-判断一个数组是不是某颗二叉搜索树的后序遍历
- C# 给你一个密码,你的任务就是判断它是不是一个安全的密码
- C++判断string是不是数字|C++获取数组长度
- 【算法-java】判断该数组是不是某二叉搜索树的后序遍历的结果