【发布时间】:2011-08-14 21:23:21
【问题描述】:
我有 2 个精灵。我使用边界框来检查与 CGRectIntersectsRect 的碰撞。但它不起作用。 HBBall 和 HBpaddle 都有一个名为 image 的 CCSprite。
初始化:
ball = [[HBBall alloc] init];
ball.position = ccp(150, 50);
[self addChild:ball];
[update addObject:ball];
paddle1 = [[HBPaddle alloc] init];
paddle1.position = ccp(50, 160);
[self addChild:paddle1];
更新:
if (CGRectIntersectsRect([paddle1.image boundingBox], [ball.image boundingBox]))
CCLOG(@"ball hit paddle");
CGRectIntersectsRect 总是返回 true。有人有想法吗?
【问题讨论】:
标签: iphone cocos2d-iphone collision-detection