# Intro to Grid Pathfinding (BFS) > Help enemies navigate around maze walls toward the player using breadth-first search on a grid. Intro to Grid Pathfinding (BFS) — Help enemies navigate around maze walls toward the player using breadth-first search on a grid. ## Core approach Number each reachable tile by its distance from the goal (0, 1, 2, 3...) using a queue list; enemies simply step to the neighbor with the lowest number. - Keep the grid compact (e.g., 16×12) for fast frame updates. - Recompute the distance grid only when the player changes tiles. - Combine with smooth gliding between tile centers. ## Pro tip & next steps BFS guarantees the shortest path around obstacles. - [All Techniques](/en/techniques/): Browse more English guides in this section. - [Scratch Block Dictionary](/en/dictionary/): Look up any Scratch 3.0 block with examples. Updated: 2026-11-23 Author: [Takamasa Suzuki](https://scratch.gmnavi.jp/about/author/) Japanese Edition: https://scratch.gmnavi.jp/techniques/pathfinding-intro/ [Scratch Daizen (English)](https://scratch.gmnavi.jp/en/)