# Lag problems

**URL:** <https://forum.makecode.com/t/lag-problems/18974>\
**Category:** Help\
**Tags:** game\
**Created:** [April 6, 2023, 5:00pm UTC](https://forum.makecode.com/t/lag-problems/18974 "2023-04-06T17:00:58Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Samsano](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/samsano/32/8307_2.png) [@Samsano](https://forum.makecode.com/u/Samsano)\
**Post date:** [April 6, 2023, 5:00pm UTC](https://forum.makecode.com/t/lag-problems/18974/1 "2023-04-06T17:00:58Z")

</div>

I am trying to pan the camera to an NPC when the distance from Character to NPC is over 50, i have done this but it lags to much because it has to calculate the distance every time. So i have identified the problem but i have come up with a solution.  
The game:

> **['The Dungeons of Ravna' game, levelbased](https://arcade.makecode.com/S68759-01823-37265-00248)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![Samsano](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/samsano/32/8307_2.png) [@Samsano](https://forum.makecode.com/u/Samsano)\
**Post date:** [April 6, 2023, 5:59pm UTC](https://forum.makecode.com/t/lag-problems/18974/2 "2023-04-06T17:59:46Z")

</div>

“have not” instead of “have”, just a typo

---

<div class="post-metadata">

**Author:** ![ChimbroDaPro](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/chimbrodapro/32/15852_2.png) [@ChimbroDaPro](https://forum.makecode.com/u/ChimbroDaPro)\
**Post date:** [April 6, 2023, 8:10pm UTC](https://forum.makecode.com/t/lag-problems/18974/3 "2023-04-06T20:10:31Z")

</div>

Lol… typo’s hurt.

---

<div class="post-metadata">

**Author:** ![SOCKMONSTER12](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sockmonster12/32/7584_2.png) [@SOCKMONSTER12](https://forum.makecode.com/u/SOCKMONSTER12)\
**Post date:** [April 6, 2023, 8:10pm UTC](https://forum.makecode.com/t/lag-problems/18974/4 "2023-04-06T20:10:36Z")

</div>

You have ot get rid of all of your on game updates that is what’s causing all of the lag.

---

<div class="post-metadata">

**Author:** ![SOCKMONSTER12](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/sockmonster12/32/7584_2.png) [@SOCKMONSTER12](https://forum.makecode.com/u/SOCKMONSTER12)\
**Post date:** [April 6, 2023, 9:24pm UTC](https://forum.makecode.com/t/lag-problems/18974/5 "2023-04-06T21:24:02Z")

</div>

here you go

> **['The Dungeons of Ravna' game, levelbased](https://arcade.makecode.com/S86750-21676-08368-94539)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.
