如何测试cocos2d中的sprite碰撞? [英] How can I test sprite collision in cocos2d?

查看:158
本文介绍了如何测试cocos2d中的sprite碰撞?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我如何开始实现类的sprite碰撞?

How do I start to implement a class for sprite collision?

推荐答案

正如Eric指出,CGRectIntersectsRect是方法测试两个重叠的边界矩形。使用CCNode类的boundingBox方法为每个sprite(或其他节点)获取正确的边界框。

As Eric pointed out, CGRectIntersectsRect is the method to test two bounding rects for overlapping. Use the boundingBox method of the CCNode classes to get the correct bounding box for each sprite (or other node).

请参见我的回答:
Cocos2d游戏中的冲突检测

这篇关于如何测试cocos2d中的sprite碰撞?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆