# Enemy movement through maze

**URL:** <https://forum.makecode.com/t/enemy-movement-through-maze/20071>\
**Category:** Help\
**Created:** [May 19, 2023, 7:58pm UTC](https://forum.makecode.com/t/enemy-movement-through-maze/20071 "2023-05-19T19:58:19Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![ArboTeach](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/arboteach/32/2990_2.png) [@ArboTeach](https://forum.makecode.com/u/ArboTeach)\
**Post date:** [May 19, 2023, 7:58pm UTC](https://forum.makecode.com/t/enemy-movement-through-maze/20071/1 "2023-05-19T19:58:19Z")

</div>

one of my students is making a pacman game [https://makecode.com/\_C20Y19c4L1YK](https://makecode.com/_C20Y19c4L1YK)  
How can we get the ghosts to move around the maze besides the set enemy to follow player block as they always get stuck behind walls?  
Thanks

---

<div class="post-metadata">

**Author:** ![YuHayate](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yuhayate/32/8275_2.png) [@YuHayate](https://forum.makecode.com/u/YuHayate)\
**Post date:** [May 22, 2023, 2:46am UTC](https://forum.makecode.com/t/enemy-movement-through-maze/20071/2 "2023-05-22T02:46:42Z")

</div>

here is a easy way  
use the path finding extention

> **[GitHub - jwunderl/arcade-tilemap-a-star: a star implementation for tilemaps...](https://github.com/jwunderl/arcade-tilemap-a-star)**
>
> a star implementation for tilemaps in pxt-arcade ---beta - GitHub - jwunderl/arcade-tilemap-a-star: a star implementation for tilemaps in pxt-arcade ---beta

you will have to create a path from the enemy’s position to the player’s position

---

<div class="post-metadata">

**Author:** ![Brohann](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/brohann/32/17380_2.png) [@Brohann](https://forum.makecode.com/u/Brohann)\
**Post date:** [May 22, 2023, 2:49am UTC](https://forum.makecode.com/t/enemy-movement-through-maze/20071/3 "2023-05-22T02:49:15Z")

</div>

Your student can use an extension such as the [Tilemap Path Finding ( a\* ) (beta)](https://forum.makecode.com/t/tilemap-path-finding-a-beta/1846) to make the ghost get to pac-man. As far as I know, the green and the pink ghosts chase him in the most direct way, while the cyan one focuses on a point 30 pixels behind pac-man, and the orange one is completely random.

---

<div class="post-metadata">

**Author:** ![ArboTeach](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/arboteach/32/2990_2.png) [@ArboTeach](https://forum.makecode.com/u/ArboTeach)\
**Post date:** [May 25, 2023, 3:57pm UTC](https://forum.makecode.com/t/enemy-movement-through-maze/20071/4 "2023-05-25T15:57:38Z")

</div>

I installed the extension after making the game so it imports the sprites and A nd B commands as well. How do I get rid of the sprites and commands as they do not show up in the code

> **[pacman](https://arcade.makecode.com/S81062-77939-24846-04260)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![Brohann](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/brohann/32/17380_2.png) [@Brohann](https://forum.makecode.com/u/Brohann)\
**Post date:** [May 26, 2023, 3:49pm UTC](https://forum.makecode.com/t/enemy-movement-through-maze/20071/5 "2023-05-26T15:49:19Z")

</div>

I’m not quite sure what is going on here, but I think I know what the problem is. Did you make sure to import the extension by searching “jwunderl/arcade-tilemap-a-star” in the extensions search bar?

---

<div class="post-metadata">

**Author:** ![ArboTeach](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/arboteach/32/2990_2.png) [@ArboTeach](https://forum.makecode.com/u/ArboTeach)\
**Post date:** [May 26, 2023, 10:30pm UTC](https://forum.makecode.com/t/enemy-movement-through-maze/20071/6 "2023-05-26T22:30:48Z")

</div>

No I found it by searching for the game link

---

<div class="post-metadata">

**Author:** ![Brohann](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/brohann/32/17380_2.png) [@Brohann](https://forum.makecode.com/u/Brohann)\
**Post date:** [May 27, 2023, 12:36am UTC](https://forum.makecode.com/t/enemy-movement-through-maze/20071/7 "2023-05-27T00:36:21Z")

</div>

I think the problem is that you used the code for the demo instead of using the extension, am I correct?
