# I need a way to get individual health for enemies

**URL:** <https://forum.makecode.com/t/i-need-a-way-to-get-individual-health-for-enemies/22284>\
**Category:** Help\
**Created:** [September 5, 2023, 5:43pm UTC](https://forum.makecode.com/t/i-need-a-way-to-get-individual-health-for-enemies/22284 "2023-09-05T17:43:53Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![Hello1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/hello1/32/20533_2.png) [@Hello1](https://forum.makecode.com/u/Hello1)\
**Post date:** [September 5, 2023, 5:43pm UTC](https://forum.makecode.com/t/i-need-a-way-to-get-individual-health-for-enemies/22284/1 "2023-09-05T17:43:53Z")

</div>

I’m making a Half-Life game and want the enemies to die in 3 hits.  
maybe a variablek that tracks hits would work? idk.

> **[Half-Life 2.5](https://arcade.makecode.com/S17010-63927-38729-01204)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/0/019385989a06550b41279c98806a175a7dac87b0.png)

---

<div class="post-metadata">

**Author:** ![Sarge](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sarge/32/19590_2.png) [@Sarge](https://forum.makecode.com/u/Sarge)\
**Post date:** [September 5, 2023, 6:16pm UTC](https://forum.makecode.com/t/i-need-a-way-to-get-individual-health-for-enemies/22284/2 "2023-09-05T18:16:47Z")

</div>

You could use the sprite data extension

---

<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:** [September 5, 2023, 6:17pm UTC](https://forum.makecode.com/t/i-need-a-way-to-get-individual-health-for-enemies/22284/3 "2023-09-05T18:17:05Z")

</div>

Love the colour palette!!!

1. Download sprite data extension
2. Make the sprite number data and set the value to the enemy life (in this case 3) when enemy is created (use on sprite of kind enemy is created block).
3. When enemy overlaps with damage source change sprite data number by -1
4. When enemy is damaged check if sprite data number ≤ 0 (less than or **equal to** is important) and if it is destroy enemy. Else do step 3

---

<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:** [September 5, 2023, 10:12pm UTC](https://forum.makecode.com/t/i-need-a-way-to-get-individual-health-for-enemies/22284/5 "2023-09-05T22:12:49Z")

</div>

![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/d/d895ea00c9bb836a0198440793525502e76bda26.png)

---

<div class="post-metadata">

**Author:** ![Hello1](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/hello1/32/20533_2.png) [@Hello1](https://forum.makecode.com/u/Hello1)\
**Post date:** [September 5, 2023, 10:14pm UTC](https://forum.makecode.com/t/i-need-a-way-to-get-individual-health-for-enemies/22284/6 "2023-09-05T22:14:08Z")

</div>

can you give an example or is this how it works?

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/8/8322a2bf3f8913273118932a7b517b3e7c86c2fc.png)

nvm it worked it’s just I accidently set it to player instead of enemy  
😅 not my brightest post lol

---

<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:** [September 6, 2023, 6:33pm UTC](https://forum.makecode.com/t/i-need-a-way-to-get-individual-health-for-enemies/22284/7 "2023-09-06T18:33:36Z")

</div>

Great!

---

<div class="post-metadata">

**Author:** ![YuHayate](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yuhayate/32/8275_2.png) [@YuHayate](https://forum.makecode.com/u/YuHayate)\
**Post date:** [September 6, 2023, 6:34pm UTC](https://forum.makecode.com/t/i-need-a-way-to-get-individual-health-for-enemies/22284/8 "2023-09-06T18:34:38Z")

</div>

you can also add the health bar extension its can make it much easyer

---

<div class="post-metadata">

**Author:** ![Mega0star01](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/mega0star01/32/14784_2.png) [@Mega0star01](https://forum.makecode.com/u/Mega0star01)\
**Post date:** [September 6, 2023, 6:34pm UTC](https://forum.makecode.com/t/i-need-a-way-to-get-individual-health-for-enemies/22284/9 "2023-09-06T18:34:51Z")

</div>

u can use statusbars.
