impact-astar-for-entities icon indicating copy to clipboard operation
impact-astar-for-entities copied to clipboard

Disable Diagonal Movement Completely

Open rontrek opened this issue 6 years ago • 3 comments
trafficstars

Hi, I'm having problems with having to disable diagonal movement completely for a tile based movement game. I already set the diagonalMovement in getPath to false, but it still follows an angle particularly in open or wide areas without obstacles, screenshot below.

astar

rontrek avatar Aug 29 '19 18:08 rontrek

Can you create a small demo and share the code, so that others can confirm the issue on their end?

Joncom avatar Aug 29 '19 22:08 Joncom

Yes, here it is: https://www.dropbox.com/s/0v89cxsrzg75w2v/astar.zip?dl=0

I have already set all entities getPath diagonalMovement parameter to false and edit a part of the level to be wider like the screenshot above.

The bug/issue shows when you click or select a new destination target while the player is moving on the current destination. Example: make the first target farther/wider and opposite then click the next target right in the middle or between the first target.

rontrek avatar Aug 30 '19 00:08 rontrek

Decreasing also the pathTimer to milliseconds triggers the diagonal behavior even when set to false.

this.pathTimer = new ig.Timer(.5);

rontrek avatar Sep 01 '19 08:09 rontrek