at first i think about the steps i need,
then i write code for this steps.
at first the pointer is in screen coord, we need world coord for the sprite.
at click you want memory the sprite (because at mouse movement you get out of the sprite area)
at release forget the sprite handle.
at mouse down you want move the sprite.
then we need the delta from a to b for x and y axis.
the length i do not need but i left in code.
for movement i use 1/10 from the original difference because i did not want the movement in one step to the new mouse position.
then you set the new position.
ready
the click offset is special,based on experience,
if you not use this offset the sprite center want goto mouse pointer at click, means the sprite move without you move your mouse at click.
for calculation i think also step for step to get the result.
AGK 108 (B)19 : Windows 8.1 Pro 64 Bit : AMD Radeon HD 6670