Yonaba / Jumper

Fast, lightweight and easy-to-use pathfinding library for grid-based games
http://yonaba.github.io/Jumper
MIT License
607 stars 122 forks source link

regenerate new path #40

Closed thoqex closed 8 years ago

thoqex commented 9 years ago

hi yonaba, thanks for the library you created. but i have a question about my TD project. can we just regenerate new path after we change the value of grid map? in example, i have a listener so i can change the value of grid map from walkable into not walkable. so when the program start and it had a endPoint. player can adding some block so we need a new path to go through the end point.

thanks

Yonaba commented 9 years ago

Hi @thoqex,

No problem, indeed you can. When you send a request to getPath, it starts looking for a path from the given start node to the given end node. During this search, it evaluates on the fly the actual state of any node which is being processed : in case this node is no longer walkable, it won't consider it. otherwise, this node will be considered in the actual search.

So basically, the workflow would be the following

Sorry for the delay, though.