Hello,
I have a function that I want to quickly check the Manhattan path distances and make sure they are collision free. In my engine I do have A* but it's computationally expensive to do server-sided, and this algorithm is much faster if it actually worked. Basically any position the character is starting on, to the end position, there is two possible Manhattan paths it should check for, the x-axis first, then y-axis or vice versa. The problem I'm having is the function is returning the middle co-ordinate in-between the path coordinates, but the actual path it's taking is causing the character to move across the collision map when it should be blocking and disregarding that path. I'm sure it's because it is not actually properly following the path that it's checking. Does anyone know how I can fix the function so the middle coordinate returned is the proper path to follow that is being checked by the collision functions yf() and xf()? Any help would be appreciated I'm so stuck, I been doing desk checks but I'm getting confused.
Oh yeah it might help if I link to the code:
https://gist.github.com/Langerz82/4a23a78ab84662f249f033e3b7cd1e90#file-findeasypath-js
the code issue is here (I think).
https://gist.github.com/Langerz82/4a23a78ab84662f249f033e3b7cd1e90#file-findeasypath-js-L113