CGRectContainsPoint和cocos2d 3.1

时间:2014-06-16 21:21:17

标签: objective-c cocos2d-iphone spritebuilder

将项目升级到SpriteBuilder 1.1和Cocos2d v3.1后,以下代码停止工作:

    -(void) touchBegan:(UITouch *)touch withEvent:(UIEvent *)event {
    CGPoint touchLocation = [touch locationInNode:_contentNode];

    //Not working
    if (CGRectContainsPoint([_arbolNegro boundingBox], touchLocation)) {
        _mouseJointNode.position = touchLocation;
        _mouseJoint = [CCPhysicsJoint connectedSpringJointWithBodyA:_mouseJointNode.physicsBody bodyB:_arbolNegro.physicsBody anchorA:ccp(0, 0) anchorB:ccp(10, 50) restLength:3.f stiffness:3.f damping:0.f];
    }
}

我认为问题是CGRectContainsPoint,因为当我消除if条件联合起作用时,但显然没有限制。有什么想法吗?

0 个答案:

没有答案