User can draw any shape on screen,
Drawing Line Using CCSprite
-(void) ccTouchesMoved:(NSSet *)touchess withEvent:(UIEvent *)event
{
UITouch *touchMyMinge = [touchess anyObject];
CGPoint start = [self convertTouchToNodeSpace:touchMyMinge];
CGPoint end = [touchMyMinge previousLocationInView:touchMyMinge.view];
end = [[CCDirector sharedDirector]convertToGL:end];
end = [self convertToNodeSpace:end];
NSValue *value= [NSValue valueWithCGPoint:start];
[linePoints addObject:value ];
float distance = ccpDistance(start, end);
for (int i = 0; i < distance; i++)
{
float difx = end.x - start.x;
float dify = end.y - start.y;
float delta = (float)i / distance;
brush = [[CCSprite spriteWithFile:[NSString stringWithFormat:@"Circle%d.png",1]] retain];
brush.scale = 2.0f;
[brush setPosition:ccp(start.x + (difx * delta), start.y + (dify * delta))];
[self add![enter image description here][1]Child:brush];
[lineSprites addObject:brush];
}
}
--> How to Check whether User drawn path is complete shape(I call it Close) or just an open line (I call it open).
Hope,I am able to explain what is the required,
Hopping for quick reply,
Thanks in advance.