-(void)ccTouchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
UITouch* touch = [touches anyObject];
CGPoint touchLocation = [touch locationInView: touch.view];
touchLocation = [[CCDirector sharedDirector] convertToGL: touchLocation];
if (isFirstTouch)
{
if (( (touchLocation.x >= (mySprite.position.x - 7)) && (touchLocation.x <= (mySprite.position.x +7) )) && ( (touchLocation.y >= (mySprite.position.y - 7)) && (touchLocation.y <= (mySprite.position.y +7) )))
{
[mySprite setPosition:ccp(touchLocation.x , touchLocation.y )];
isFirstTouch = NO;
}
}
else
{
[mySprite setPosition:ccp(touchLocation.x , touchLocation.y )];
}
- (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
isFirstTouch = YES;
}
UITouch* touch = [touches anyObject];
CGPoint touchLocation = [touch locationInView: touch.view];
touchLocation = [[CCDirector sharedDirector] convertToGL: touchLocation];
if (isFirstTouch)
{
if (( (touchLocation.x >= (mySprite.position.x - 7)) && (touchLocation.x <= (mySprite.position.x +7) )) && ( (touchLocation.y >= (mySprite.position.y - 7)) && (touchLocation.y <= (mySprite.position.y +7) )))
{
[mySprite setPosition:ccp(touchLocation.x , touchLocation.y )];
isFirstTouch = NO;
}
}
else
{
[mySprite setPosition:ccp(touchLocation.x , touchLocation.y )];
}
- (void)ccTouchesEnded:(NSSet *)touches withEvent:(UIEvent *)event
{
isFirstTouch = YES;
}