# Enemies not dying?

**URL:** <https://forum.makecode.com/t/enemies-not-dying/22827>\
**Category:** Help\
**Tags:** game, make\
**Created:** [September 27, 2023, 5:19pm UTC](https://forum.makecode.com/t/enemies-not-dying/22827 "2023-09-27T17:19:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Arexcl](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/arexcl/32/10427_2.png) [@Arexcl](https://forum.makecode.com/u/Arexcl)\
**Post date:** [September 27, 2023, 5:19pm UTC](https://forum.makecode.com/t/enemies-not-dying/22827/1 "2023-09-27T17:19:19Z")

</div>

The enemies in my game wont die, can someone help?

> **[Inferno](https://arcade.makecode.com/S02929-90070-44692-69731)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![AlexK](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/alexk/32/33339_2.png) [@AlexK](https://forum.makecode.com/u/AlexK)\
**Post date:** [September 27, 2023, 7:11pm UTC](https://forum.makecode.com/t/enemies-not-dying/22827/2 "2023-09-27T19:11:26Z")

</div>

Really nice game, @Arexcl ! I really like the look of the game, and I think you nailed the ambiance. It feels terrifying.

I started the debugger to see why your enemy health did not seem to change. You can see part of my session in the clip below.

![Inferno-20230927](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/2X/6/6c5a7e9e5ef12e1afc48d7a09d4258198c13e31b.gif)

It seems like your event handler is not running, since the breakpoint that I set (the red circle next to one of the blocks in the workspace) never hits. If it did, the simulator would pause and I would be able to see information in the debugger.

I have some guesses as to why, but I have not dug deeply into this one yet. My guess is that, because you are in a `forever` loop where you manage the animation, the overlap events do not fire. I can try to look at this one a bit more closely after I get back from the office, but that’s my initial guess.

---

<div class="post-metadata">

**Author:** ![Vegz78](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/vegz78/32/1201_2.png) [@Vegz78](https://forum.makecode.com/u/Vegz78)\
**Post date:** [September 30, 2023, 9:21am UTC](https://forum.makecode.com/t/enemies-not-dying/22827/3 "2023-09-30T09:21:25Z")

</div>

Hi @Arexcl,

It seems that when sprites are set _relative to camera_, like you here do with the _Weapon_ sprite so that it is always in the correct relative position to the _TorchSprite_ sprite, they are also set to _Ghost_ mode, i.e. no hitbox.

I have updated your code here, where I only have removed _relative to camera_ for the weapon, and instead update its position for every game loop inside an _OnGameUpdate_ block to the same x and y postion as _TorchSprite_:

> **[Inferno\_WeaponUpdate](https://arcade.makecode.com/74983-68007-66900-13428)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

This quick n’ dirty solution seems to work well enough to me, but according to this discussion, there is a small nuance between wether to do this before or after the camera updates, which you could control to a finer degree by using the _Sprite Utils_ extension:

> [@Creating a UI (Overlay) - Relative to camera - without ghosting the sprites](https://forum.makecode.com/t/creating-a-ui-overlay-relative-to-camera-without-ghosting-the-sprites/8268/5):
>
> The easiest way to do this would be to not use “relative to camera”, but instead position the sprites on every frame yourself! We have some camera blocks in the scene category that are useful for this. One note: this won’t work inside an “on game update” because the camera doesn’t get updated until after that code gets run. Luckily, I added a block to @jwunderl’s jwunderl/arcade-sprite-util to make this easier: Here’s a link to the example: [https://make…](https://makecode.com/_9FkEaFey5eC9)

I am unsure if this can be solved by other means as well, like reactivating the hitbox periodically or otherwise. That would be a question for a more experienced forum member.
