# Sprite Following with Micro:Bit?

**URL:** <https://forum.makecode.com/t/sprite-following-with-micro-bit/12102>\
**Category:** micro:bit\
**Created:** [February 9, 2022, 6:03pm UTC](https://forum.makecode.com/t/sprite-following-with-micro-bit/12102 "2022-02-09T18:03:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MisterGorp](https://avatars.discourse-cdn.com/v4/letter/m/ebca7d/32.png) [@MisterGorp](https://forum.makecode.com/u/MisterGorp)\
**Post date:** [February 9, 2022, 6:03pm UTC](https://forum.makecode.com/t/sprite-following-with-micro-bit/12102/1 "2022-02-09T18:03:22Z")

</div>

Can you make a sprite follow another sprite with a Micro:Bit? Maybe a way to make a sprite point towards another sprite and walk forward? Thanks

---

<div class="post-metadata">

**Author:** ![jmallitt](https://avatars.discourse-cdn.com/v4/letter/j/67e7ee/32.png) [@jmallitt](https://forum.makecode.com/u/jmallitt)\
**Post date:** [September 16, 2022, 4:46pm UTC](https://forum.makecode.com/t/sprite-following-with-micro-bit/12102/2 "2022-09-16T16:46:08Z")

</div>

Hello MisterGorp,

I know this reply is very late, but I just started fiddling with my microbit and worked out a solution.

Unfortunately, I dont know how to do it in block format, but it can be achieved by using python code:

This code is for two sprites, where an enemy follows the player, with a time delay of 50 milliseconds:

```
    if enemy.x() < player.x():
        enemy.change(LedSpriteProperty.X, 1)
    basic.pause(50)
    if enemy.x() > player.x():
        enemy.change(LedSpriteProperty.X, -1)
    basic.pause(50)
    if enemy.x() < player.y():
        enemy.change(LedSpriteProperty.Y, 1)
    basic.pause(50)
    if enemy.x() > player.y():
        enemy.change(LedSpriteProperty.Y, -1)

```

All the best!
