# Optimization help

**URL:** https://forum.makecode.com/t/optimization-help/38802
**Category:** Help
**Tags:** game
**Created:** [August 21, 2025, 2:38am UTC](https://forum.makecode.com/t/optimization-help/38802 "2025-08-21T02:38:05Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![Ima.notarobot](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/ima.notarobot/32/26551_2.png) [@Ima.notarobot](https://forum.makecode.com/u/Ima.notarobot)
#### Post date: [August 21, 2025, 2:38am UTC](https://forum.makecode.com/t/optimization-help/38802/1 "2025-08-21T02:38:05Z")

</div>

Hey this is my game. I added lava recently and it spreads in your screen when it has an open spot on its left right or bottom. If you need to test click menu, and you will fly and ghost through walls. hold A to mine if you need to test making an open spot near lava. [https://arcade.makecode.com/S35154-96391-14231-97749](https://arcade.makecode.com/S35154-96391-14231-97749)

P.S generating your cave takes a while wait a tiny bit. Also lava is hard to locate – look for a while.

---

<div class="post-metadata">

### Author: ![BlobDev](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/blobdev/32/25519_2.png) [@BlobDev](https://forum.makecode.com/u/BlobDev)
#### Post date: [August 21, 2025, 4:03am UTC](https://forum.makecode.com/t/optimization-help/38802/2 "2025-08-21T04:03:49Z")

</div>

Very laggy on mobile

---

<div class="post-metadata">

### Author: ![Ima.notarobot](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/ima.notarobot/32/26551_2.png) [@Ima.notarobot](https://forum.makecode.com/u/Ima.notarobot)
#### Post date: [August 21, 2025, 4:30pm UTC](https://forum.makecode.com/t/optimization-help/38802/3 "2025-08-21T16:30:07Z")

</div>

Now imagine it on a school chrome book.

---

<div class="post-metadata">

### Author: ![BlobDev](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/blobdev/32/25519_2.png) [@BlobDev](https://forum.makecode.com/u/BlobDev)
#### Post date: [August 21, 2025, 5:24pm UTC](https://forum.makecode.com/t/optimization-help/38802/4 "2025-08-21T17:24:16Z")

</div>

Absalute nightmare

---

<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: [August 22, 2025, 3:18am UTC](https://forum.makecode.com/t/optimization-help/38802/5 "2025-08-22T03:18:07Z")

</div>

Ur main problem is that it spikes to 200+ sprites every second. If you can do that without sprites, using (tile to left of (location)” code for example, it would be a lot less laggy.

---

<div class="post-metadata">

### Author: ![Ima.notarobot](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/ima.notarobot/32/26551_2.png) [@Ima.notarobot](https://forum.makecode.com/u/Ima.notarobot)
#### Post date: [August 22, 2025, 4:58pm UTC](https://forum.makecode.com/t/optimization-help/38802/6 "2025-08-22T16:58:50Z")

</div>

Thank you! That is a very good solution. One question, how can I make it ask if a tile next to the tiles location ask if a certain tile is there? Sorry, that’s the best way I could put it.

---

<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: [August 22, 2025, 5:50pm UTC](https://forum.makecode.com/t/optimization-help/38802/7 "2025-08-22T17:50:01Z")

</div>

This should work:

 ![Screenshot 2025-08-22 at 1.36.40 PM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/7/3/7347738a20a927c463e365b42c2c64d74a96fa09.png)  
As a developer, I would find a different way to do the cheat-mode change, so that I still had access to the system menu. That way I could easily see the fps and sprite count whenever I wanted. For example, I can see you still have 44 sprites floating around, and idk if those are all those scorpion things or if they are left over from cave generation.

---

<div class="post-metadata">

### Author: ![Ima.notarobot](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/ima.notarobot/32/26551_2.png) [@Ima.notarobot](https://forum.makecode.com/u/Ima.notarobot)
#### Post date: [August 22, 2025, 6:15pm UTC](https://forum.makecode.com/t/optimization-help/38802/8 "2025-08-22T18:15:48Z")

</div>

Thank you so much!

---

<div class="post-metadata">

### Author: ![Ima.notarobot](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/ima.notarobot/32/26551_2.png) [@Ima.notarobot](https://forum.makecode.com/u/Ima.notarobot)
#### Post date: [August 27, 2025, 5:39pm UTC](https://forum.makecode.com/t/optimization-help/38802/9 "2025-08-27T17:39:49Z")

</div>

Finally had time to try it out, and it works like a charm ♥

---

<div class="post-metadata">

### Author: ![Ima.notarobot](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/ima.notarobot/32/26551_2.png) [@Ima.notarobot](https://forum.makecode.com/u/Ima.notarobot)
#### Post date: [September 11, 2025, 9:21pm UTC](https://forum.makecode.com/t/optimization-help/38802/10 "2025-09-11T21:21:47Z")

</div>

Hey, @WoofWoof may I have one more tinsy winsy bit of help with this project? When I added in the lava to my game, none of the tiles like TNT or bushes / rocks are generating. the only tile that is generating out of the tiles that are supposed to be placed on the ground are spikes.

---

<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 11, 2025, 9:40pm UTC](https://forum.makecode.com/t/optimization-help/38802/11 "2025-09-11T21:40:41Z")

</div>

Yeah I’ll look at it when I get home. Make sure the link is updated.

---

<div class="post-metadata">

### Author: ![Ima.notarobot](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/ima.notarobot/32/26551_2.png) [@Ima.notarobot](https://forum.makecode.com/u/Ima.notarobot)
#### Post date: [September 11, 2025, 10:35pm UTC](https://forum.makecode.com/t/optimization-help/38802/12 "2025-09-11T22:35:22Z")

</div>

thank you! It is.

---

<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 12, 2025, 5:19pm UTC](https://forum.makecode.com/t/optimization-help/38802/13 "2025-09-12T17:19:47Z")

</div>

Everything seems to be generating just fine for me…  
Ok, the first time I ran it, I literally spawned on top of a TNT, but now trying it again nothing is generating, like you said. I think it’s a lag issue. There is probably enough lag during generation that by the time everything catches up, that Number2 variable is already set to 6, and that makes everything be spikes. I really think you should just stop using sprites for this stuff. Sprite movement is susceptible to lag, is inconsistent, etc etc, and spawning… 35 \* 6 sprites is not gonna work well.  
I changed the code to this:

 ![Screenshot 2025-09-12 at 11.14.16 AM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/d/9/d9b47963ea4c1143f5655eedc805bdce6a26635f.png)  
And now I’m seeing TNT and some other stuff, so the lag is probably catching up around Number2 = 3, but that’s still not very good. Also, why are you using those “after (ms)” blocks? Just using the Pause(ms) block would do the exact same thing. The reason people use those “After” blocks is usually because pausing inside the block they are using would freeze the whole game, which some blocks like “On Game Update” will do. Since you’re inside a function, and that function is inside the OnStart block (which doesn’t pause the whole game when paused) you don’t need to use them!  
Anyways, I decided to get rid of all that sprite stuff and just replaced that whole section with this:  
 ![Screenshot 2025-09-12 at 11.43.14 AM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/4/1/41e8ad020f8c5ec9a65ae6992927ca8f15eba095.png)  
Here’s the link so you can copy the code easily:

> **[Goat Miner Legends](https://arcade.makecode.com/S82427-72537-68278-19258)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

### Author: ![Ima.notarobot](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/ima.notarobot/32/26551_2.png) [@Ima.notarobot](https://forum.makecode.com/u/Ima.notarobot)
#### Post date: [September 12, 2025, 8:11pm UTC](https://forum.makecode.com/t/optimization-help/38802/14 "2025-09-12T20:11:19Z")

</div>

@WoofWoof , I really appreciate you doing this! Your an awesome community member! thank you. And yes, I will stop using sprites for generation. 😔
