CCSprite获取点击对象

- (void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event{
    UITouch *touch = [touches anyObject];
    CGPoint p1 = [touch locationInView:nil];
    //p1.y = 480-p1.y;
    CGPoint p3 = [self convertToNodeSpace:[[CCDirector sharedDirector] convertToGL:p1]];
    CGRect rect = [self.play.plane boundingBox];
    bool bo = CGRectContainsPoint(rect, p3);
    NSLog(@"=======%i", bo);
    //self.play.plane.getBody->
}

你可能感兴趣的:(Objective-C)