On second thought. I can not wrap my mind on that question. What you do/want is this (illustrated) :
We stand on the side of a loch. You say: go as close as you can to that point in the water on the other side. But dont get wet, avoid water.
I take look at the map. Loch Lomond. Loch Morar. Loch Ness. That is gonna be a serious walk.
After 3 hours, i am there. Now you say, jump into the water to where i said that you should end the journey. So, i jump.
But now i am wet. So i stand there in the water.
Now you say: go as close as you can to that point in the water on the other side. But dont get wet, avoid water.
Eh? I should have taken a boat. But then i have to avoid land.
1/ Of course. Use two tilemaps. 1 for the show. Erase the tile in the base tile map, set the tile in the show tilemap, find path, when path found, set the tile in the base tilemap, erase the tile in the show tilemap.
2/ Yeah, do as above, find path to mouse.X and mouse.Y
But that is not gonna work for tiles that are surrounded with other tiles. Because they are obstacles. I have no idea if you have surrounded tiles. So you need 3 tilemaps.
1 to mark the border tiles, leaving the surrounded tiles errased, use that as obstacle map.
1 to fill the surrounded tiles.
1 as a temporary to move tiles, that are obstacles but that you dont want to be obstacles, to. And back again.
Alternative, once they reach the second last index of the points in the calculated path, just move them to the stored mouseX/mouseY
But that is so way off from what you wanted in the first place.
So, or adjust the tilemap so a path can be found. Or, make the last move a straight move to the mouse.
I think the most effective thing would be to, as you suggest, make a straight move to the mouse, but I don't know how to condition if the player is already on the tile. Obstacles won't be much of a problem I don't think because it only seems to care about the origin point, but it would be fun to see if the player gets stuck or not, I just don't know how to try this.