在网上看到的是cgrect的方法
CGRect projectileRect = CGRectMake(projectile.position.x , projectile.position.y , projectile.contentSize.width , projectile.contentSize.height );
CGRect targetRect = CGRectMake(target.position.x , target.position.y , target.contentSize.width, target.contentSize.height);
if (CGRectIntersectsRect(projectileRect, targetRect)) {
碰撞了.
}
自己用的ccrect的这个方法
CCRect hookstance=CCRectMake(hook->getPosition().x, hook->getPosition().y, hook->getContentSize().width, hook->getContentSize().height);
CCRect shistance=CCRectMake(shi->getPosition().x,shi->getPosition().y, shi->getContentSize().width, shi->getContentSize().height);
if (hookstance.intersectsRect(shistance))
{
碰撞了
}