0

在我将项目升级到 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 条件时,联合工作,但显然没有限制。任何想法?

4

0 回答 0