# Trouble with game running very slowly

**URL:** <https://forum.code.org/t/trouble-with-game-running-very-slowly/26689>\
**Category:** Coding and Debugging Help\
**Created:** [May 3, 2019, 1:38pm UTC](https://forum.code.org/t/trouble-with-game-running-very-slowly/26689 "2019-05-03T13:38:12Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![molson](https://avatars.discourse-cdn.com/v4/letter/m/e0b2c6/32.png) [@molson](https://forum.code.org/u/molson)\
**Post date:** [May 3, 2019, 1:38pm UTC](https://forum.code.org/t/trouble-with-game-running-very-slowly/26689/1 "2019-05-03T13:38:12Z")

</div>

My student has created a “Pacman” type of game, but it runs so slowly that it would not be fun to play. We are thinking the problem might have something to do with the code checking a conditional often, but we are not sure. He has tried increasing the worldFrame rate but that doesn’t seem to affect the program when he runs it. Here is the link to his game.  
[https://studio.code.org/projects/gamelab/JWaCtkp1zIhVACgICWp5JAqiaM8fmXFg5pphm6rUzUs](https://studio.code.org/projects/gamelab/JWaCtkp1zIhVACgICWp5JAqiaM8fmXFg5pphm6rUzUs)

---

<div class="post-metadata">

**Author:** ![bradleywellsashley](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.code.org/bradleywellsashley/32/522_2.png) [@bradleywellsashley](https://forum.code.org/u/bradleywellsashley)\
**Post date:** [May 5, 2019, 12:31am UTC](https://forum.code.org/t/trouble-with-game-running-very-slowly/26689/2 "2019-05-05T00:31:46Z")

</div>

Molly,

Good thinking - but the problem, that I can see, is inside the draw loop the student is calling the `maze` and `border` functions, so EVERY frame they are being redrawn. I remixed and pulled those two functions before the draw loop and it was much smoother.

It’s an impressive game! Congrats!

Brad
