if (CCRect:CCRectIntersectsRect(m_bullet:boundingBox(), m_enemy:boundingBox())) then print(“aaaa”) end
这样写出错了。
听说有很多种碰撞检测,我这里要问题的是两个矩形。也就是射击击中的检测。
已经自己解决了。
用
local rect = m_enemy:getBoundingBox() –碰撞检测 if rect:intersectsRect(m_bullet:getBoundingBox()) then print(“中”) end