First: Click twice to place the line. Second: Move the Distance slider to choose how far the center of the sprite must be from any point on the line to register as touching Third: Move the mouse and see the touching work!
Made while working on my remix of @uplift 's Touch https://scratch.mit.edu/projects/78383832/ I'm actually not going to use this kind of collision... oh, well. I tried to simplify @_youtubeN1 's project as much as possible, for use in Touch. Hooray for algebra! Here's my explanation for why the point on a line that is nearest to another point will from a line perpendicular to the given line: Since the hypotenuse is the longest side of a right triangle, the legs of the triangle will always be shorter than the hypotenuse (unless the hypotenuse IS the leg). We place two points of a right triangle on a line and a third somewhere out in space. This third point will be connected to the other two points by a leg, which is perpendicular to the line that also forms the right triangle's base, and by a hypotenuse. No matter where we place the hypotenuse point on the line, the leg point will always be closer to the third point.