What happens now is, I create an object on the screen where the user touches the screen. It remembers the x and y position from where the player starts touching the screen. Now when the user moves his finger it will follow the users finger this works fine.

But now i want it to keep following the direction of the finger after the finger reaches a certain distance from the starting position.Now I know how to calculate distance, but how would I make it too keep following the direction of the finger, but not follow it completely after for example a distance of 30 pixels from the starting position. So it stops at 30 pixels from the starting position, but if you would draw a line from the start position to the users finger position, the control object would be on the same line, but not further away then 30 pixels from the starting pos.