I am having problems with this method. I have two rectangles that are obviously contained within each other. (I even draw their coordinates manually to make sure.) When I use CGRectContainsRect to compare these two rectangles, it returns false. For life, I tried everything, combed the network, and I can not find the answer to this problem. Can anyone understand why? I have included values for CGR when I am debugging to show that they are definitely within each other.
-(bool)checkBoundingBox {
bool returnItem = YES;
for (int i = 0; i < [arrGameItems count]; i++) {
CGRect rect2 = [[self getChildByTag:1] boundingBox];
CGRect rect1 = [[self getChildByTag:3] boundingBox];
if (CGRectContainsRect(rect2, rect1)) {
CCLOG(@"removed child b*&ch");
[self removeChildByTag:[arrGameItems count] cleanup:YES];
returnItem = NO;
}
}
CCLOG(@"g-dammit");
return returnItem;
}
rect1 origin x = 141 y = 76, height = 25, width = 25
rect2 origin x = 127 y = 91, height = 25, width = 25
source
share