Me too. This isn't a beginner project. Here's one attempt that will find if two clicked on tiles have a free path between them with no more than two bends.
The idea is when you click on a tile it marks spots horizontal and vertical from the tile that are free. The same is done for the second tile. Then each pair of spots is looked at. If a pair is found to be horizontal or vertical, and there are no tiles between them then we have a free path. The final step is to draw a line from the tiles through the spots.
uc6340427eb04ffd179f33182a89.dl.dropboxusercontent.com/cd/0/get/Ch9zAOyB6gHBBx3P8kK6C_7UIg1UfyI3ALxfCuPYidxL68aOqlOxv1GMJv0Doy5kCdQdWHmWsffO8FMtHxk7FPyVCvZJCY_9QsyIpiaNDK6wuHtZXWESYnqZ486kfWdwe2RUHwNakuiKj0nAFKFrVnQX/file
Maybe some ideas can be gleaned from that. It has some limits and I won't work on it further.
I think there was a previous discussion that utilized a pathfinder to find the paths too. I forget if anything came of that.