# Help with destroying a sprite from an array

**URL:** https://forum.makecode.com/t/help-with-destroying-a-sprite-from-an-array/43382
**Category:** Help
**Tags:** game
**Created:** [April 16, 2026, 10:38pm UTC](https://forum.makecode.com/t/help-with-destroying-a-sprite-from-an-array/43382 "2026-04-16T22:38:23Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![temmie](https://avatars.discourse-cdn.com/v4/letter/t/e274bd/32.png) [@temmie](https://forum.makecode.com/u/temmie)
#### Post date: [April 16, 2026, 10:38pm UTC](https://forum.makecode.com/t/help-with-destroying-a-sprite-from-an-array/43382/1 "2026-04-16T22:38:23Z")

</div>

i have an array with 3 sprites the 3 sprites all chase the player, z places the 3 sprites in random places, x starts and stops there chasing, and c (uses a keybored compatable extension) destroys the closests sprite, but i cant get it to target the closest sprite, also i want to be able to limit tne range of destroying the sprite

heres the link [https://arcade.makecode.com/S02703-58638-26883-01322](https://arcade.makecode.com/S02703-58638-26883-01322)

---

<div class="post-metadata">

### Author: ![NeverStopTheCoder](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/neverstopthecoder/32/21194_2.png) [@NeverStopTheCoder](https://forum.makecode.com/u/NeverStopTheCoder)
#### Post date: [April 17, 2026, 12:39am UTC](https://forum.makecode.com/t/help-with-destroying-a-sprite-from-an-array/43382/2 "2026-04-17T00:39:35Z")

</div>

![Screenshot 2026-04-16 8.35.01 PM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/1/c/1cfd137e5848c8036b6533d00e02f38f7c224fc6.png)something like this should work
