[英]How to make two object collide in cocos 2d?
if (CGRectIntersectsRect(projectileRect, targetRects))
{
NSLog(@"ha ha Collision detected");
}
CGRect projectileRect = [player boundingBox];
CGRect targetRects = [anEnemy boundingBox];
This is the code i am using for collision.The problem is many time the collision get not checked.If it get checked the position of collision is bottom left or right. 这是我用于碰撞的代码。问题是很多时候没有检查碰撞。如果检查了碰撞的位置是左下还是右下。
PLease advise what to do or any sample of how to do collision.ALso i am not using box or chimpunk 请告知该怎么做或如何进行碰撞的任何示例。所以我不使用盒子或黑猩猩
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.