I really need help.
i have a circle sprite, and this code
-(void)ccTouchesBegan:(NSSet *)touches withEvent:(UIEvent *)event
{
CGSize winSize =[[CCDirector sharedDirector] winSize];
UITouch* myTouch = [touches anyObject];
CGPoint location = [myTouch locationInView: [myTouch view]];
location = [[CCDirector sharedDirector]convertToGL:location];
CCSprite *circleSprite = (CCSprite*)[self getChildByTag:30];
CGRect correctColorSprite1 = [circleSprite boundingBox];
if (CGRectContainsPoint(correctColorSprite1, location)) {
NSLog(@"inside");
}
as i know there is a bounding box, when i touch slightly outside of the top circle it will still detect the touch.
Now i need help to eliminate this, i have read this post from this link http://www.cocos2d-iphone.org/forum/topic/8803.
But after reading it I'm confused how to incorporate it. Currently my circle size is in 50 points.
I hope someone can help me out give me some snippets of a improved code to detect the touch only in the circle.