r/programming • • Apr 23 '13

PathFinding algorithm, visually explained

http://qiao.github.io/PathFinding.js/visual/
2.2k Upvotes

230 comments sorted by

View all comments

Show parent comment

2

u/BraveSirRobin Apr 28 '13

I guess so. 100% assumption but I'd say there are two distinct ways to handle movement. The "proper" way is a vector, you have direction and velocity which makes it easy to ensure the same max speed in all directions.

The other way would be to simply add/subtract values to the players coordinates depending on what direction the controller was indicating. The top speed diagonally is basically the hypotenuse of a right-angled triangle. Say they move 1 meter per second north and 1 meter per second east, they will have travelled north east by 1.4 metres from the start point.