pathfinding_tutorial icon indicating copy to clipboard operation
pathfinding_tutorial copied to clipboard

Second path is ignored if you click before first path is finished.

Open JamesX88 opened this issue 7 years ago • 1 comments

If you click the bottom right tile, and then click the top left tile, the character will flicker for a second and then continue on the original bottom right path. So, the second (new) path is ignored.

Is that intended? Have would you recommend dealing with this?

JamesX88 avatar Oct 27 '18 17:10 JamesX88

No that's not intended, and I actually should have dealt with it in the demo! I should test that hypothesis but I expect that this happens because the timeline triggered by the first click is not stopped when doing the second click.

When I have more time I'll take time to fix this but here is already what I would try:

  • Store the active timeline somewhere to be able to access it, e.g. Game.timeline (intialized to null)
  • Inside handleClick, check if there is an active timeline, and if yes (not null), call stop() on it
  • Start the new timeline, and store it in Game.timeline in stead of the previous one

If you try it, feel free to let me know if it works!

Jerenaux avatar Oct 28 '18 12:10 Jerenaux