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

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

问题描述

如何开始实现精灵碰撞类?

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

推荐答案

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

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 中测试精灵碰撞?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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