# Enemies not loading when hit level 2

**URL:** <https://forum.makecode.com/t/enemies-not-loading-when-hit-level-2/4839>\
**Category:** Help\
**Created:** [December 8, 2020, 12:26am UTC](https://forum.makecode.com/t/enemies-not-loading-when-hit-level-2/4839 "2020-12-08T00:26:26Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Genosity](https://avatars.discourse-cdn.com/v4/letter/g/e8c25b/32.png) [@Genosity](https://forum.makecode.com/u/Genosity)\
**Post date:** [December 8, 2020, 12:26am UTC](https://forum.makecode.com/t/enemies-not-loading-when-hit-level-2/4839/1 "2020-12-08T00:26:26Z")

</div>

Im currently working on a platformer called hexvoid, and there is an enemy where if you step on its nest, the mom swoops down and attacks you. But in level 2, whenever you step on the nest, the only thing that happens is the nest disappearing. Can someone help me please?  
[The game that is having issues on level 2](https://makecode.com/_AxAA5hTc75mA)

---

<div class="post-metadata">

**Author:** ![cosmoscowboy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/cosmoscowboy/32/1718_2.png) [@cosmoscowboy](https://forum.makecode.com/u/cosmoscowboy)\
**Post date:** [December 8, 2020, 5:58pm UTC](https://forum.makecode.com/t/enemies-not-loading-when-hit-level-2/4839/2 "2020-12-08T17:58:33Z")

</div>

The enemies do appear, just the first one in the second level is outside the bounds of the screen. I added the function ‘constrain a between b and c’ to each of the x/y locations you are setting to the enemy.

For the x constraint, I used the screen width as the ‘lower bound’ and the upper bound is the value you want to set.  
For the y constraint, I used ‘0’ as the lower bound, and the screen width as the ‘upper bound’.

If you want an explanation of what the ‘constrain’ function does, when you highlight it in the Math menu you can right click and select Help.

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

---

<div class="post-metadata">

**Author:** ![cosmoscowboy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/cosmoscowboy/32/1718_2.png) [@cosmoscowboy](https://forum.makecode.com/u/cosmoscowboy)\
**Post date:** [December 9, 2020, 12:25am UTC](https://forum.makecode.com/t/enemies-not-loading-when-hit-level-2/4839/3 "2020-12-09T00:25:54Z")

</div>

> [@cosmoscowboy](#):
>
> For the y constraint, I used ‘0’ as the lower bound, and the screen width as the ‘upper bound’.

This should be:  
For the y constraint, I used ‘0’ as the lower bound, and the screen _height_ as the ‘upper bound’.
