I had encountered the same problem earlier. I fixed it for my game by modifying the -touchesMoved method in the Joystick.m file.
Just copy and replace the following code with the -touchesMoved
method in Joystick.m
-(void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event
{
if (isTracking == YES)
{
for (UITouch *touch in touches)
{
CGPoint touchPoint = [touch locationInNode:self];
if (sqrtf(powf((touchPoint.x - self.anchorPointInPoints.x), 2) + powf((touchPoint.y - self.anchorPointInPoints.y), 2)) <= thumbNode.size.width)
{
CGPoint moveDifference = CGPointMake(touchPoint.x - self.anchorPointInPoints.x, touchPoint.y - self.anchorPointInPoints.y);
thumbNode.position = CGPointMake(self.anchorPointInPoints.x + moveDifference.x, self.anchorPointInPoints.y + moveDifference.y);
}
else
{
double vX = touchPoint.x - self.anchorPointInPoints.x;
double vY = touchPoint.y - self.anchorPointInPoints.y;
if (!(vX > 256 || vY > 256)) //Touchpoint should be within limits. Change the values to suit your situation.
{
double magV = sqrt(vX*vX + vY*vY);
double aX = self.anchorPointInPoints.x + vX / magV * thumbNode.size.width;
double aY = self.anchorPointInPoints.y + vY / magV * thumbNode.size.width;
thumbNode.position = CGPointMake(aX, aY);
}
}
}
velocity = CGPointMake(((thumbNode.position.x - self.anchorPointInPoints.x)), ((thumbNode.position.y - self.anchorPointInPoints.y)));
angularVelocity = -atan2(thumbNode.position.x - self.anchorPointInPoints.x, thumbNode.position.y - self.anchorPointInPoints.y);
[_delegate joystickMovement];
}
}