pathfinding_tutorial
pathfinding_tutorial copied to clipboard
Second path is ignored if you click before first path is finished.
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?
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 tonull) - Inside
handleClick, check if there is an active timeline, and if yes (notnull), callstop()on it - Start the new timeline, and store it in
Game.timelinein stead of the previous one
If you try it, feel free to let me know if it works!