# 4 Pathfinding / Player Follow Examples (Platforming & Top-Down)

**URL:** <https://community.flowlab.io/t/4-pathfinding-player-follow-examples-platforming-top-down/36367>\
**Category:** Examples & Tutorials\
**Created:** [April 26, 2022, 12:37am UTC](https://community.flowlab.io/t/4-pathfinding-player-follow-examples-platforming-top-down/36367 "2022-04-26T00:37:31Z")\
**Posts on this page:** 1\
**Showing post:** 28

<div class="post-metadata">

**Author:** ![thebrickccentric](https://community.flowlab.io/user_avatar/community.flowlab.io/thebrickccentric/32/71689_2.png) [@thebrickccentric](https://community.flowlab.io/u/thebrickccentric)\
**Post date:** [June 28, 2025, 8:14pm UTC](https://community.flowlab.io/t/4-pathfinding-player-follow-examples-platforming-top-down/36367/28 "2025-06-28T20:14:31Z")

</div>

Yet another optimization of my normal Breadth-First Search (BFS) pathfinding:  
[https://flowlab.io/games/play/2812295](https://flowlab.io/games/play/2812295)

It has all the features of version 3, plus many improvements to it, including a guarantee that the pathfinding will stop as soon as all the enemies have found a path to the closest player (which ensures max performance), a more flexible and streamlined behavior system for adding / removing target objects (the players in this case), better handling of enemy movement when very far away from targets (they won’t stutter as much or move slower), and diagonal enemy movement that no longer can get stuck when corners look like this:  
 ![diagonal corner](https://community.flowlab.io/uploads/default/original/3X/1/8/18a227b1ccc51338ae7fba239bffadecb1e7b82b.png)

This version is also simpler than version 3, so hopefully the code will be easier for people to understand . . . feel free to ask questions or give feedback!

---

_[View the full topic](https://community.flowlab.io/t/4-pathfinding-player-follow-examples-platforming-top-down/36367)._
