# Enemy AI - Other way of chasing the player instead of a follow block?

**URL:** <https://forum.makecode.com/t/enemy-ai-other-way-of-chasing-the-player-instead-of-a-follow-block/10589>\
**Category:** Help\
**Created:** [October 27, 2021, 4:10pm UTC](https://forum.makecode.com/t/enemy-ai-other-way-of-chasing-the-player-instead-of-a-follow-block/10589 "2021-10-27T16:10:04Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![personalnote](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/personalnote/32/31359_2.png) [@personalnote](https://forum.makecode.com/u/personalnote)\
**Post date:** [October 27, 2021, 4:10pm UTC](https://forum.makecode.com/t/enemy-ai-other-way-of-chasing-the-player-instead-of-a-follow-block/10589/1 "2021-10-27T16:10:04Z")

</div>

I want the enemies to follow the player on a tile with collision. I pretty much want this because I’m making a 2D platformer shooter game (Well, something like Metroid Dread), and I don’t like the fact that my enemies basically fly. I’m also creating a type of enemy similar to the EMMI, which means that the enemy basically patrols around an area, and can basically climb onto walls and ceilings. Can someone help me with this please?

Can someone also tell me if this makes sense (and i’ll need help on the code for this):  
Because the EMMI has 3 modes, there will be 3 ranges. The first range is the EMMI’s search mode, in which if you enter the range, then the EMMI will begin heading to the location where you entered its range. Every 5 seconds you are in the EMMI’s search range the EMMI will be alerted to a new location. The second range is the EMMI’s chase mode, which is much shorter compared to the search range. basically it will make the EMMI more faster and will start chasing you no matter where you go. And the third range is the escape range. If you are able to run past the escape range while the EMMI is chasing you, then the EMMI will return back to patrolling.

---

<div class="post-metadata">

**Author:** ![Kiwiphoenix364](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/kiwiphoenix364/32/14368_2.png) [@Kiwiphoenix364](https://forum.makecode.com/u/Kiwiphoenix364)\
**Post date:** [October 27, 2021, 5:36pm UTC](https://forum.makecode.com/t/enemy-ai-other-way-of-chasing-the-player-instead-of-a-follow-block/10589/2 "2021-10-27T17:36:22Z")

</div>

I might be able to help if I don’t have too much school work

---

<div class="post-metadata">

**Author:** ![TheJaky](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/thejaky/32/5711_2.png) [@TheJaky](https://forum.makecode.com/u/TheJaky)\
**Post date:** [October 27, 2021, 6:55pm UTC](https://forum.makecode.com/t/enemy-ai-other-way-of-chasing-the-player-instead-of-a-follow-block/10589/3 "2021-10-27T18:55:00Z")

</div>

I think there might be an extension that could help, but i’ll have to search for it

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [October 27, 2021, 7:16pm UTC](https://forum.makecode.com/t/enemy-ai-other-way-of-chasing-the-player-instead-of-a-follow-block/10589/4 "2021-10-27T19:16:13Z")

</div>

we’ll be doing something similar to this on [stream](https://twitch.tv/msmakecode) today at 1:00 PM PDT

---

<div class="post-metadata">

**Author:** ![Kiwiphoenix364](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/kiwiphoenix364/32/14368_2.png) [@Kiwiphoenix364](https://forum.makecode.com/u/Kiwiphoenix364)\
**Post date:** [October 27, 2021, 7:16pm UTC](https://forum.makecode.com/t/enemy-ai-other-way-of-chasing-the-player-instead-of-a-follow-block/10589/5 "2021-10-27T19:16:37Z")

</div>

The sprite utils extension might work (It’ll probably have the needed blocks, but you’ll still have to manually code it.)

---

<div class="post-metadata">

**Author:** ![personalnote](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/personalnote/32/31359_2.png) [@personalnote](https://forum.makecode.com/u/personalnote)\
**Post date:** [October 28, 2021, 5:07pm UTC](https://forum.makecode.com/t/enemy-ai-other-way-of-chasing-the-player-instead-of-a-follow-block/10589/6 "2021-10-28T17:07:37Z")

</div>

By the way, here is the link to the game: [https://makecode.com/\_7AkCV5chYCr8](https://makecode.com/_7AkCV5chYCr8)

---

<div class="post-metadata">

**Author:** ![personalnote](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/personalnote/32/31359_2.png) [@personalnote](https://forum.makecode.com/u/personalnote)\
**Post date:** [November 1, 2021, 9:12pm UTC](https://forum.makecode.com/t/enemy-ai-other-way-of-chasing-the-player-instead-of-a-follow-block/10589/7 "2021-11-01T21:12:19Z")

</div>

I watched the stream, but the code seemed too complex and would go against some of the code that i already have

---

<div class="post-metadata">

**Author:** ![personalnote](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/personalnote/32/31359_2.png) [@personalnote](https://forum.makecode.com/u/personalnote)\
**Post date:** [November 18, 2021, 1:14am UTC](https://forum.makecode.com/t/enemy-ai-other-way-of-chasing-the-player-instead-of-a-follow-block/10589/8 "2021-11-18T01:14:28Z")

</div>

is there a simpler way to do this?

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [November 18, 2021, 5:03pm UTC](https://forum.makecode.com/t/enemy-ai-other-way-of-chasing-the-player-instead-of-a-follow-block/10589/9 "2021-11-18T17:03:41Z")

</div>

@personalnote try giving @jwunderl’s a-star extension a shot:

> **[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

It adds some blocks to the scene category that let you have sprites follow paths around tilemaps

---

<div class="post-metadata">

**Author:** ![personalnote](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/personalnote/32/31359_2.png) [@personalnote](https://forum.makecode.com/u/personalnote)\
**Post date:** [November 18, 2021, 10:47pm UTC](https://forum.makecode.com/t/enemy-ai-other-way-of-chasing-the-player-instead-of-a-follow-block/10589/10 "2021-11-18T22:47:01Z")

</div>

thank you so much

---

<div class="post-metadata">

**Author:** ![soloslayer](https://avatars.discourse-cdn.com/v4/letter/s/bc8723/32.png) [@soloslayer](https://forum.makecode.com/u/soloslayer)\
**Post date:** [January 30, 2023, 11:11pm UTC](https://forum.makecode.com/t/enemy-ai-other-way-of-chasing-the-player-instead-of-a-follow-block/10589/11 "2023-01-30T23:11:34Z")

</div>

this changes what i’ve been working on
