# How to make an enemy that follows you to the right or left and doesn’t fly

**URL:** <https://forum.makecode.com/t/how-to-make-an-enemy-that-follows-you-to-the-right-or-left-and-doesn-t-fly/17375>\
**Category:** Help\
**Tags:** game\
**Created:** [January 11, 2023, 6:31pm UTC](https://forum.makecode.com/t/how-to-make-an-enemy-that-follows-you-to-the-right-or-left-and-doesn-t-fly/17375 "2023-01-11T18:31:21Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Esben](https://avatars.discourse-cdn.com/v4/letter/e/e47c2d/32.png) [@Esben](https://forum.makecode.com/u/Esben)\
**Post date:** [January 11, 2023, 6:31pm UTC](https://forum.makecode.com/t/how-to-make-an-enemy-that-follows-you-to-the-right-or-left-and-doesn-t-fly/17375/1 "2023-01-11T18:31:21Z")

</div>

So I am making an enemy that follows you so if you’re left then it goes to the left or if you’re on the right it goes right. Now I know that there is the follow sprite thingy but that makes the enemy fly and the enemy is smaller than the player so it’s levitating. Here is a link to the game. Bc I don’t want the enemy to fly after you when you jump. I want it to stay on the ground. Help much appreciated. [https://arcade.makecode.com/S67326-02387-81003-29766](https://arcade.makecode.com/S67326-02387-81003-29766)  
The enemy is named Dumbarn and main character Poul

---

<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:** [January 11, 2023, 6:49pm UTC](https://forum.makecode.com/t/how-to-make-an-enemy-that-follows-you-to-the-right-or-left-and-doesn-t-fly/17375/2 "2023-01-11T18:49:54Z")

</div>

this is easy to do with an “on game update” block! here’s some sample code:

> **[platformer-follow-example](https://arcade.makecode.com/S12528-30638-09245-95465)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

if you have multiple enemies in your game, you’ll need to wrap it in a “for each” loop like this:

> **[platformer-follow-example-multipleenemies](https://arcade.makecode.com/28187-77837-81281-78575)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![Esben](https://avatars.discourse-cdn.com/v4/letter/e/e47c2d/32.png) [@Esben](https://forum.makecode.com/u/Esben)\
**Post date:** [January 11, 2023, 11:02pm UTC](https://forum.makecode.com/t/how-to-make-an-enemy-that-follows-you-to-the-right-or-left-and-doesn-t-fly/17375/3 "2023-01-11T23:02:23Z")

</div>

Thanks this was what I was looking for but I messed around and made what I was looking for. Thanks for the help

---

<div class="post-metadata">

**Author:** ![bella\_luvcatz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/bella_luvcatz/32/21857_2.png) [@bella\_luvcatz](https://forum.makecode.com/u/bella_luvcatz)\
**Post date:** [August 19, 2025, 6:09pm UTC](https://forum.makecode.com/t/how-to-make-an-enemy-that-follows-you-to-the-right-or-left-and-doesn-t-fly/17375/4 "2025-08-19T18:09:52Z")

</div>

Hi, do you know how to make it so it doesn’t overlap with the player and is just next to it? I can’t find a tut TvT…

---

<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:** [August 19, 2025, 6:21pm UTC](https://forum.makecode.com/t/how-to-make-an-enemy-that-follows-you-to-the-right-or-left-and-doesn-t-fly/17375/5 "2025-08-19T18:21:06Z")

</div>

@bella_luvcatz sure, just change the distance check in the on game update:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/9/e/9eb428a56cb888aaff9cf87d8b00834ea4c746ff.png)

if you change that 2 to be a higher number (like 16), then the sprite will stop further away from the sprite it’s following

---

<div class="post-metadata">

**Author:** ![bella\_luvcatz](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/bella_luvcatz/32/21857_2.png) [@bella\_luvcatz](https://forum.makecode.com/u/bella_luvcatz)\
**Post date:** [August 20, 2025, 12:06am UTC](https://forum.makecode.com/t/how-to-make-an-enemy-that-follows-you-to-the-right-or-left-and-doesn-t-fly/17375/6 "2025-08-20T00:06:15Z")

</div>

Thanks 😄
