# Bug in initiating combat

**URL:** <https://forum.makecode.com/t/bug-in-initiating-combat/44845>\
**Category:** Help\
**Created:** [July 8, 2026, 11:03pm UTC](https://forum.makecode.com/t/bug-in-initiating-combat/44845 "2026-07-08T23:03:24Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sword\_Studios](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sword_studios/32/35216_2.png) [@Sword\_Studios](https://forum.makecode.com/u/Sword_Studios)\
**Post date:** [July 8, 2026, 11:03pm UTC](https://forum.makecode.com/t/bug-in-initiating-combat/44845/1 "2026-07-08T23:03:24Z")

</div>

![Screenshot 2026-07-08 6.19.41 PM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/8/3/83eb9679711491d8907504561f9bc41a64d5bbbb.png)

Lot of things wrong with this code.

1. Initiating combat with the ghost always freezes the game.
2. The player starts with decreased HP, as well as the ghost.
3. The game says something’s wrong with the status bar, but I can’t find out what’s wrong with it.

If you have any tips that would be really helpful

---

<div class="post-metadata">

**Author:** ![Soleb244](https://avatars.discourse-cdn.com/v4/letter/s/aeb1de/32.png) [@Soleb244](https://forum.makecode.com/u/Soleb244)\
**Post date:** [July 9, 2026, 11:18pm UTC](https://forum.makecode.com/t/bug-in-initiating-combat/44845/2 "2026-07-09T23:18:10Z")

</div>

Could you send a link to your project? The code isnt very readable from the screenshot and it will make debuging it much easier

---

<div class="post-metadata">

**Author:** ![VoxelMaster64](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/voxelmaster64/32/32075_2.png) [@VoxelMaster64](https://forum.makecode.com/u/VoxelMaster64)\
**Post date:** [July 9, 2026, 11:18pm UTC](https://forum.makecode.com/t/bug-in-initiating-combat/44845/3 "2026-07-09T23:18:12Z")

</div>

the quality of the image seems to be bad (at least on my phone), can you share the project?

---

<div class="post-metadata">

**Author:** ![Sword\_Studios](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sword_studios/32/35216_2.png) [@Sword\_Studios](https://forum.makecode.com/u/Sword_Studios)\
**Post date:** [July 9, 2026, 11:18pm UTC](https://forum.makecode.com/t/bug-in-initiating-combat/44845/4 "2026-07-09T23:18:15Z")

</div>

And now the projectiles stay for less than 50 milliseconds even though they’re set to 500.

---

<div class="post-metadata">

**Author:** ![Sword\_Studios](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sword_studios/32/35216_2.png) [@Sword\_Studios](https://forum.makecode.com/u/Sword_Studios)\
**Post date:** [July 10, 2026, 3:43pm UTC](https://forum.makecode.com/t/bug-in-initiating-combat/44845/5 "2026-07-10T15:43:35Z")

</div>

yea here

> **[bossfights](https://arcade.makecode.com/S91876-86032-13652-12642)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![MrGhost15](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/mrghost15/32/33300_2.png) [@MrGhost15](https://forum.makecode.com/u/MrGhost15)\
**Post date:** [July 11, 2026, 2:03am UTC](https://forum.makecode.com/t/bug-in-initiating-combat/44845/6 "2026-07-11T02:03:35Z")

</div>

I do want to ask why the boss is a ghost because doesn’t that mean that it won’t take damage because it avoids physical collision?

---

<div class="post-metadata">

**Author:** ![MrGhost15](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/mrghost15/32/33300_2.png) [@MrGhost15](https://forum.makecode.com/u/MrGhost15)\
**Post date:** [July 11, 2026, 2:03am UTC](https://forum.makecode.com/t/bug-in-initiating-combat/44845/7 "2026-07-11T02:03:44Z")

</div>

Also when it comes to having full status bar for skelly and the player, you have to set the max value it can go to first, then set the value that it starts at.

For reference:

 ![Screenshot 2026-07-10 113744](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/a/4/a4b24ec896540128f6e293a5a622c6aae35db82b.png)

---

<div class="post-metadata">

**Author:** ![Soleb244](https://avatars.discourse-cdn.com/v4/letter/s/aeb1de/32.png) [@Soleb244](https://forum.makecode.com/u/Soleb244)\
**Post date:** [July 11, 2026, 2:06am UTC](https://forum.makecode.com/t/bug-in-initiating-combat/44845/8 "2026-07-11T02:06:31Z")

</div>

Okay so the statusbard arent full because you are setting the value before the max, you just need to swap the order.

It crasher here when you click A

 ![1000029088](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/a/1/a1452caf58c93cddd024d70be3978651132eeaba.jpeg)

I think its because skellyflare doesnt exist yet

If it crashes, you can use debuging mode to see which exact block caused the crash.

---

<div class="post-metadata">

**Author:** ![VoxelMaster64](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/voxelmaster64/32/32075_2.png) [@VoxelMaster64](https://forum.makecode.com/u/VoxelMaster64)\
**Post date:** [July 11, 2026, 6:01pm UTC](https://forum.makecode.com/t/bug-in-initiating-combat/44845/9 "2026-07-11T18:01:01Z")

</div>

it freezes because of the while loop. I think you want an if but im not sure.
