Mouse.x(layer)
mouse.y(layer)
Return the position of the mouse cursor in layer co-ordinates, with scrolling, scaling and rotation taken in to account for the given layer. The layer can be identified either by a string of its name or its zero-based index, e.g. Mouse.X("HUD").
Did you make sure you got the right mouse coords? Are you parralaxing or zooming or scrolling?
also note my notation for x, y is not the same as yours, your x is my dist, your y is my theta. I made this notation change because x,y is commonly a coordinate and it is consistent with C3 notation.