Hi. I have a 16x16 grid, player moves by grid movement.
The green circle in the attached picture is the player. Trying to create a line attack (the yellow line) that extends out from the player and as far as the range (variable) of the line. In this case the range would be 4. If the mouse pointer is beyond the maximum range, the line draws towards the mouse but at the range number of squares.
Hope that makes sense