# Moving sprite aggro

**URL:** https://forum.makecode.com/t/moving-sprite-aggro/28343
**Category:** Help
**Created:** [April 21, 2024, 12:25am UTC](https://forum.makecode.com/t/moving-sprite-aggro/28343 "2024-04-21T00:25:08Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![Lilvince](https://avatars.discourse-cdn.com/v4/letter/l/e9a140/32.png) [@Lilvince](https://forum.makecode.com/u/Lilvince)
#### Post date: [April 21, 2024, 12:25am UTC](https://forum.makecode.com/t/moving-sprite-aggro/28343/1 "2024-04-21T00:25:08Z")

</div>

how would I make a moving enemy aggro the player if it sees them? (the player being in front of the enemy) and I would also like it so that the enemy loses aggro when sight is cut off, EX: wall, door, ect

---

<div class="post-metadata">

### Author: ![Luke](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/luke/32/32519_2.png) [@Luke](https://forum.makecode.com/u/Luke)
#### Post date: [April 21, 2024, 2:50am UTC](https://forum.makecode.com/t/moving-sprite-aggro/28343/2 "2024-04-21T02:50:08Z")

</div>

> **[GitHub - felixtsu/pxt-sight: MakeCode 项目](https://github.com/felixtsu/pxt-sight)**
>
> MakeCode 项目. Contribute to felixtsu/pxt-sight development by creating an account on GitHub.

This extension should be helpful

---

<div class="post-metadata">

### Author: ![HaruhitoGames](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/haruhitogames/32/14658_2.png) [@HaruhitoGames](https://forum.makecode.com/u/HaruhitoGames)
#### Post date: [April 21, 2024, 6:37pm UTC](https://forum.makecode.com/t/moving-sprite-aggro/28343/3 "2024-04-21T18:37:06Z")

</div>

dont know if this works but maybe use the sprite util extension and Do: Forever If my sprite distance =\_\_ set my enemy follow my sprite Else\_\_\_\_\_\_\_

---

<div class="post-metadata">

### Author: ![Lilvince](https://avatars.discourse-cdn.com/v4/letter/l/e9a140/32.png) [@Lilvince](https://forum.makecode.com/u/Lilvince)
#### Post date: [April 21, 2024, 11:27pm UTC](https://forum.makecode.com/t/moving-sprite-aggro/28343/4 "2024-04-21T23:27:00Z")

</div>

thats what I have been using before this post got approved and luke suggested that extension, I just ended up making the enemy blind but he can still aggro

---

<div class="post-metadata">

### Author: ![Lilvince](https://avatars.discourse-cdn.com/v4/letter/l/e9a140/32.png) [@Lilvince](https://forum.makecode.com/u/Lilvince)
#### Post date: [April 22, 2024, 3:19pm UTC](https://forum.makecode.com/t/moving-sprite-aggro/28343/5 "2024-04-22T15:19:54Z")

</div>

how would I make it so that a death animation played with the raycast animation block??

---

<div class="post-metadata">

### Author: ![HaruhitoGames](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/haruhitogames/32/14658_2.png) [@HaruhitoGames](https://forum.makecode.com/u/HaruhitoGames)
#### Post date: [April 23, 2024, 4:01am UTC](https://forum.makecode.com/t/moving-sprite-aggro/28343/6 "2024-04-23T04:01:40Z")

</div>

um… I never used the raycasting exteinsion so I’m not sure sorry @Lilvince

---

<div class="post-metadata">

### Author: ![Lilvince](https://avatars.discourse-cdn.com/v4/letter/l/e9a140/32.png) [@Lilvince](https://forum.makecode.com/u/Lilvince)
#### Post date: [April 23, 2024, 4:59am UTC](https://forum.makecode.com/t/moving-sprite-aggro/28343/7 "2024-04-23T04:59:24Z")

</div>

it’s okay, I figured it out (eventually)

---

<div class="post-metadata">

### Author: ![Rombus](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/rombus/32/19729_2.png) [@Rombus](https://forum.makecode.com/u/Rombus)
#### Post date: [February 14, 2025, 6:47pm UTC](https://forum.makecode.com/t/moving-sprite-aggro/28343/8 "2025-02-14T18:47:04Z")

</div>

How did you figure it out? Can you please tell me? I’ve been having this problem but something similar; I want it so that if you look at the enemy directly, there would be a 50% chance that it’ll disappear and a 50% chance that it’ll chase the player. 🙂
