so i have a sprite that implements the TargetedTouchDelegate protocol and basically all it is supposed to do is you can drag the sprite across the screen. My problem is that when I zip my finger across the screen the sprite lags a little bit behind. I am not sure exactly whats happening, maybe the iphone is buffering these touches so my game is receiving touches that are just a little outdated? Its pretty important to my game that the sprite is directly under my finger even when the finger is moving too fast. I imagine I could look at the finger acceleration and make the sprite move a little faster by predicting the fingers movement, but i figure first i should check if there is something i am not understanding.
here is the relevant code although i dont think it will help
-(CGRect)getTouchBox
{
return CGRectMake(-15, -15, 30, 30);
}
- (BOOL)ccTouchBegan:(UITouch *)touch withEvent:(UIEvent *)event
{
if (moving == YES)
return NO;
CGPoint convertedPoint = [self convertTouchToNodeSpaceAR:touch];
if (CGRectContainsPoint([self getTouchBox], convertedPoint)) {
moving = YES;
return YES;
}
else
return NO;
}
- (void)ccTouchMoved:(UITouch *)touch withEvent:(UIEvent *)event
{
CGPoint touchPoint = [touch locationInView:[touch view]];
touchPoint = [[Director sharedDirector] convertCoordinate:touchPoint];
self.position = CGPointMake(touchPoint.x, touchPoint.y);
}
- (void)ccTouchEnded:(UITouch *)touch withEvent:(UIEvent *)event
{
moving = NO;
}
thanks for any help!