how do I make the user draw the path he wants the "player" to move?
I thought about using pathfinding, I would do the entire layout as solid and when drawing a line the user will "destroy or erase" the obstacles and then make the "player" look for a route.
is it possible to do so?
please help me!!
Develop games in your browser. Powerful, performant & highly capable.
Mmm... there are several ways to do this. I would recommend using an array to record the drawn path.
On path drawing active, every set interval push the mouse coordinates to the back of an array.
On path drawing finished, have the player object move to each coordinate recorded in the array in sequence.
If you don't want to use an array, you can try using invisible helper sprites instead. As you draw the path, you can create these "cookie crumb" helper objects at a set interval at the mouse location for the player object to follow.