# Trouble updating my enemy's health bar

**URL:** <https://forum.makecode.com/t/trouble-updating-my-enemys-health-bar/34276>\
**Category:** Help\
**Tags:** extension\
**Created:** [March 4, 2025, 1:20pm UTC](https://forum.makecode.com/t/trouble-updating-my-enemys-health-bar/34276 "2025-03-04T13:20:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Holderify](https://avatars.discourse-cdn.com/v4/letter/h/9fc348/32.png) [@Holderify](https://forum.makecode.com/u/Holderify)\
**Post date:** [March 4, 2025, 1:20pm UTC](https://forum.makecode.com/t/trouble-updating-my-enemys-health-bar/34276/1 "2025-03-04T13:20:15Z")

</div>

I’m trying to make a game where you have enemies that teleport around you and you deflect their projectiles, damaging them. However, I’m having a problem with the enemy’s health bar not updating. I don’t know whether it’s that I’m not actually damaging the enemy when I deflect or whether it’s a problem with updating the UI for the health bar.  
[Game](https://arcade.makecode.com/S20587-19638-69605-09813)

---

<div class="post-metadata">

**Author:** ![Anna](https://avatars.discourse-cdn.com/v4/letter/a/779978/32.png) [@Anna](https://forum.makecode.com/u/Anna)\
**Post date:** [March 5, 2025, 10:20pm UTC](https://forum.makecode.com/t/trouble-updating-my-enemys-health-bar/34276/2 "2025-03-05T22:20:22Z")

</div>

Check these

1. Is it in order?
2. Is there too much code?
3. What health bar!?

---

<div class="post-metadata">

**Author:** ![Holderify](https://avatars.discourse-cdn.com/v4/letter/h/9fc348/32.png) [@Holderify](https://forum.makecode.com/u/Holderify)\
**Post date:** [March 5, 2025, 10:44pm UTC](https://forum.makecode.com/t/trouble-updating-my-enemys-health-bar/34276/3 "2025-03-05T22:44:23Z")

</div>

![Screenshot 2025-03-05 5.25.03 PM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/9/9/997e5918507c9d90dbfc6f675ef72214ed636c80.png) This is the enemy hp bar and it wont update

---

<div class="post-metadata">

**Author:** ![Holderify](https://avatars.discourse-cdn.com/v4/letter/h/9fc348/32.png) [@Holderify](https://forum.makecode.com/u/Holderify)\
**Post date:** [March 6, 2025, 1:29pm UTC](https://forum.makecode.com/t/trouble-updating-my-enemys-health-bar/34276/4 "2025-03-06T13:29:09Z")

</div>

I also want to know if there is a way to make the A button release if it has been held down for a certain amount of time.
