# Why is my while loop freezing thegame?

**URL:** <https://forum.makecode.com/t/why-is-my-while-loop-freezing-thegame/45915>\
**Category:** Help\
**Tags:** make\
**Created:** [September 15, 2026, 10:37pm UTC](https://forum.makecode.com/t/why-is-my-while-loop-freezing-thegame/45915 "2026-09-15T22:37:42Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![Spike](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/spike/32/33316_2.png) [@Spike](https://forum.makecode.com/u/Spike)\
**Post date:** [September 15, 2026, 10:37pm UTC](https://forum.makecode.com/t/why-is-my-while-loop-freezing-thegame/45915/1 "2026-09-15T22:37:42Z")

</div>

im trying to make it so a sprite gets bigger in size as it goes and im trying to use a while not loop but it just freezes my game before anything happens

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/c/5/c57d8cda8a4102e56272bcd16c6c088e133e0000.png)

> **[fan made knught bossfight](https://arcade.makecode.com/S81050-16677-74219-99229)**
>
> removed the while not loop pls help

WHAT did i do wrong

---

<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:** [September 15, 2026, 10:46pm UTC](https://forum.makecode.com/t/why-is-my-while-loop-freezing-thegame/45915/2 "2026-09-15T22:46:07Z")

</div>

Well because nothing in the loop does anything with the variable, it will repeat infinitely. Youre kinda just asking makecode to scale the sprite infinite times in a single frame. You need to set the variable to 0 somewhere in the while loop or use the break block.

---

<div class="post-metadata">

**Author:** ![Bilangus](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/bilangus/32/33219_2.png) [@Bilangus](https://forum.makecode.com/u/Bilangus)\
**Post date:** [September 16, 2026, 1:43am UTC](https://forum.makecode.com/t/why-is-my-while-loop-freezing-thegame/45915/3 "2026-09-16T01:43:02Z")

</div>

If your gonna finish this demake then feel free to use sprites or code from my own:

> [@\[Announcement\] MakeCode Arcade Mini Game Jam #35 - Cursed Jam 3](https://forum.makecode.com/t/announcement-makecode-arcade-mini-game-jam-35-cursed-jam-3/44312/129):
>
> JUMPY PLATFORMER BUT YOU HAVE A SWORD Quite possibly the jumpy platformer mod of all time! DISCLAIMER: If you are richard don’t play this before the livestream. If you are not richard also don’t reply about The Thing before the livestream. This game kinda relies on a bit of a twist. On a totally unrelated note, DELTARUNE TOMORROW!!!

---

<div class="post-metadata">

**Author:** ![Spike](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/spike/32/33316_2.png) [@Spike](https://forum.makecode.com/u/Spike)\
**Post date:** [September 16, 2026, 1:44am UTC](https://forum.makecode.com/t/why-is-my-while-loop-freezing-thegame/45915/4 "2026-09-16T01:44:42Z")

</div>

ok i put a pause block in the loop and its working now

---

<div class="post-metadata">

**Author:** ![YamJam](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yamjam/32/29681_2.png) [@YamJam](https://forum.makecode.com/u/YamJam)\
**Post date:** [September 16, 2026, 1:47am UTC](https://forum.makecode.com/t/why-is-my-while-loop-freezing-thegame/45915/5 "2026-09-16T01:47:07Z")

</div>

Because while loops run in the main loop, it will pause your other code until the current iteration is finished. (I think that’s why)

---

<div class="post-metadata">

**Author:** ![WoofWoof](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/woofwoof/32/32523_2.png) [@WoofWoof](https://forum.makecode.com/u/WoofWoof)\
**Post date:** [September 16, 2026, 1:49am UTC](https://forum.makecode.com/t/why-is-my-while-loop-freezing-thegame/45915/6 "2026-09-16T01:49:00Z")

</div>

What @Soleb244 said, or you could use a pause block somewhere in the while loop to let other code run and potentially stop the while loop from outside of it.

---

<div class="post-metadata">

**Author:** ![YamJam](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/yamjam/32/29681_2.png) [@YamJam](https://forum.makecode.com/u/YamJam)\
**Post date:** [September 16, 2026, 7:33pm UTC](https://forum.makecode.com/t/why-is-my-while-loop-freezing-thegame/45915/7 "2026-09-16T19:33:52Z")

</div>

Nevermind turns out I’m an absolute idiot

---

<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:** [September 17, 2026, 2:25am UTC](https://forum.makecode.com/t/why-is-my-while-loop-freezing-thegame/45915/8 "2026-09-17T02:25:20Z")

</div>

No your not! dont say that about yourself! You just wrote read it wrong, dont call yourself an idiot. its not nice.

---

<div class="post-metadata">

**Author:** ![Spike](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/spike/32/33316_2.png) [@Spike](https://forum.makecode.com/u/Spike)\
**Post date:** [September 17, 2026, 9:42pm UTC](https://forum.makecode.com/t/why-is-my-while-loop-freezing-thegame/45915/9 "2026-09-17T21:42:59Z")

</div>

can we delete this topic already
