# Why is it that there are random invincible enemies?

**URL:** <https://forum.makecode.com/t/why-is-it-that-there-are-random-invincible-enemies/31348>\
**Category:** Help\
**Tags:** game\
**Created:** [October 25, 2024, 5:01pm UTC](https://forum.makecode.com/t/why-is-it-that-there-are-random-invincible-enemies/31348 "2024-10-25T17:01:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![PLAYER42](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@PLAYER42](https://forum.makecode.com/u/PLAYER42)\
**Post date:** [October 25, 2024, 5:01pm UTC](https://forum.makecode.com/t/why-is-it-that-there-are-random-invincible-enemies/31348/1 "2024-10-25T17:01:14Z")

</div>

I’m working on a arcadey space shooter game and I’ve got the basic outline of it done but, on double enemy spawns there will be one enemy that is invincible and transfers its damage to the other.  
How can I fix this? Thanks

> **[Shoter](https://arcade.makecode.com/S05444-03372-29317-23855)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![redSprite](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/redsprite/32/34262_2.png) [@redSprite](https://forum.makecode.com/u/redSprite)\
**Post date:** [October 26, 2024, 7:55pm UTC](https://forum.makecode.com/t/why-is-it-that-there-are-random-invincible-enemies/31348/2 "2024-10-26T19:55:40Z")

</div>

Try using the sprite utils extension  
I don’t know what else to say

---

<div class="post-metadata">

**Author:** ![PLAYER42](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@PLAYER42](https://forum.makecode.com/u/PLAYER42)\
**Post date:** [November 1, 2024, 2:39am UTC](https://forum.makecode.com/t/why-is-it-that-there-are-random-invincible-enemies/31348/3 "2024-11-01T02:39:18Z")

</div>

Thanks, although, I don’t quite know how to use that extension lol, may I ask how would I apply it for my game?

---

<div class="post-metadata">

**Author:** ![redSprite](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/redsprite/32/34262_2.png) [@redSprite](https://forum.makecode.com/u/redSprite)\
**Post date:** [November 1, 2024, 2:42pm UTC](https://forum.makecode.com/t/why-is-it-that-there-are-random-invincible-enemies/31348/4 "2024-11-01T14:42:21Z")

</div>

Wait,  
I see your problem

 ![Screenshot (44)](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/8/3/83b8248a78f451ed49f6e0aa916f6dc06711142c.png)  
You see, the Variable block will update to the latest sprite created with that variable, so it will destroy the most recent created enemy instead.  
Here’s how to fix it:  
 ![Screenshot (45)](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/f/3/f3a1c5d89fed1bcc029b4d1113911294e4622244.png)  
“OtherSprite” is referring to the Enemy the projectile collided with, so it will destroy the correct one instead.

---

<div class="post-metadata">

**Author:** ![PLAYER42](https://avatars.discourse-cdn.com/v4/letter/p/e9bcb4/32.png) [@PLAYER42](https://forum.makecode.com/u/PLAYER42)\
**Post date:** [November 8, 2024, 12:32am UTC](https://forum.makecode.com/t/why-is-it-that-there-are-random-invincible-enemies/31348/5 "2024-11-08T00:32:47Z")

</div>

Thanks mate! That fixed it!
