The line is supposed to start from ({start x},{start y}) and go to your mouse-pointer by using a function to get the direction between 2 points. Unfortunately, the calculated position is incorrect to a few decimal places because of the scratch float limits.
All code by me. The formula is from this website (french) : https://www.dcode.fr/changement-coordonnees-2d I adapted it to scratch. This tutorial about vectors by @Java_Programmer helped me: https://scratch.mit.edu/projects/229216889/ Thanks to Zebby121 who tell me that the formula Because of somethings with trigonometry, it doesn't works when: y1=y2 and x1>x2 Another formula I made myself: https://scratch.mit.edu/projects/561244940/