# Arcade-mini-menu extension

**URL:** <https://forum.makecode.com/t/arcade-mini-menu-extension/14368>\
**Category:** Show & Tell\
**Tags:** extension\
**Created:** [July 7, 2022, 6:20pm UTC](https://forum.makecode.com/t/arcade-mini-menu-extension/14368 "2022-07-07T18:20:41Z")\
**Posts on this page:** 20\
**Page:** 3

<div class="post-metadata">

**Author:** ![Not-a-creepy-doll](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/not-a-creepy-doll/32/28255_2.png) [@Not-a-creepy-doll](https://forum.makecode.com/u/Not-a-creepy-doll)\
**Post date:** [September 26, 2024, 7:53pm UTC](https://forum.makecode.com/t/arcade-mini-menu-extension/14368/41 "2024-09-26T19:53:43Z")

</div>

Hey, @richard the mini memu doesn’t seem to show for me  
I don’t want to reveal the game here’s the code

 ![Screenshot 2024-09-26 2.04.57 PM](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/f/2/f2afe4878ab61efc989e4855f466d82938d931e0.png)  
every time I overlap with the tile and press A it doesn’t do anything. Could help mega please.

---

<div class="post-metadata">

**Author:** ![CopySprite](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/copysprite/32/36304_2.png) [@CopySprite](https://forum.makecode.com/u/CopySprite)\
**Post date:** [September 26, 2024, 9:27pm UTC](https://forum.makecode.com/t/arcade-mini-menu-extension/14368/42 "2024-09-26T21:27:07Z")

</div>

Try putting a stay in screen block for the menu that’s what I do.  
If my way isn’t the right way to do it somebody tell me.

---

<div class="post-metadata">

**Author:** ![Not-a-creepy-doll](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/not-a-creepy-doll/32/28255_2.png) [@Not-a-creepy-doll](https://forum.makecode.com/u/Not-a-creepy-doll)\
**Post date:** [September 26, 2024, 10:27pm UTC](https://forum.makecode.com/t/arcade-mini-menu-extension/14368/43 "2024-09-26T22:27:00Z")

</div>

It worked thank you very much 🙏

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [September 27, 2024, 4:52pm UTC](https://forum.makecode.com/t/arcade-mini-menu-extension/14368/44 "2024-09-27T16:52:31Z")

</div>

@CopySprite instead of stay in screen, you want to turn on “relative to camera”. that will prevent the sprite from being affected by the camera.

it’s in the dropdown of this block:

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

---

<div class="post-metadata">

**Author:** ![CopySprite](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/copysprite/32/36304_2.png) [@CopySprite](https://forum.makecode.com/u/CopySprite)\
**Post date:** [September 27, 2024, 4:53pm UTC](https://forum.makecode.com/t/arcade-mini-menu-extension/14368/45 "2024-09-27T16:53:40Z")

</div>

Thank you.

---

<div class="post-metadata">

**Author:** ![wispycrispy](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/wispycrispy/32/19222_2.png) [@wispycrispy](https://forum.makecode.com/u/wispycrispy)\
**Post date:** [September 27, 2024, 9:26pm UTC](https://forum.makecode.com/t/arcade-mini-menu-extension/14368/46 "2024-09-27T21:26:41Z")

</div>

Is there a way to set the menu items as all the values stored in an array like for an inventory?

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [September 27, 2024, 9:29pm UTC](https://forum.makecode.com/t/arcade-mini-menu-extension/14368/47 "2024-09-27T21:29:44Z")

</div>

there are two versions of the create menu sprite block and the second one takes in an array.

the easiest way to do this would be to make an empty array and then loop over all of your inventory items and push a menu item into the empty array for each one. then you can create the menu sprite out of your constructed array of values.

---

<div class="post-metadata">

**Author:** ![Not-a-creepy-doll](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/not-a-creepy-doll/32/28255_2.png) [@Not-a-creepy-doll](https://forum.makecode.com/u/Not-a-creepy-doll)\
**Post date:** [October 11, 2024, 11:30pm UTC](https://forum.makecode.com/t/arcade-mini-menu-extension/14368/48 "2024-10-11T23:30:18Z")

</div>

I’m back … again, but this time with more of a question than a problem.  
Is there a way I can make different options appear if a condition is met or is the only way to do that is by making like 100+ menu types?

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [October 15, 2024, 5:02pm UTC](https://forum.makecode.com/t/arcade-mini-menu-extension/14368/49 "2024-10-15T17:02:07Z")

</div>

@Not-a-creepy-doll underneath the first create menu block there is one that takes in an array instead. you can conditionally add or remove things from the menu by building up an array of menu items.

here’s an example game that conditionally controls what appears in the menu:

> **[menu-conditional-example](https://arcade.makecode.com/82776-99935-25602-69254)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

---

<div class="post-metadata">

**Author:** ![Not-a-creepy-doll](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/not-a-creepy-doll/32/28255_2.png) [@Not-a-creepy-doll](https://forum.makecode.com/u/Not-a-creepy-doll)\
**Post date:** [October 16, 2024, 5:09pm UTC](https://forum.makecode.com/t/arcade-mini-menu-extension/14368/50 "2024-10-16T17:09:50Z")

</div>

This worked wonders thank you 😄👍  
(i see you liking all my post ms. president… what’s going on here? 🤨)

---

<div class="post-metadata">

**Author:** ![BlueYoshi507](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/blueyoshi507/32/32630_2.png) [@BlueYoshi507](https://forum.makecode.com/u/BlueYoshi507)\
**Post date:** [October 21, 2024, 7:02pm UTC](https://forum.makecode.com/t/arcade-mini-menu-extension/14368/51 "2024-10-21T19:02:15Z")

</div>

@richard How do I make a menu like this:  
If the options is selected, the is unable to choose again.

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

**AND ALSO I STILL DON’T UNDERSTAND HOW TO INCREASE FPS IN THE GAME, CAN SOMEONE PLEASE GIVE ME A TUTORIAL OR INSTRUCTIONS OF HOW TO DO IT!?** thx 🙂

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [October 21, 2024, 9:17pm UTC](https://forum.makecode.com/t/arcade-mini-menu-extension/14368/52 "2024-10-21T21:17:13Z")

</div>

@BlueYoshi507 like this?

> **[menu-disable-example](https://arcade.makecode.com/11206-78969-10153-03696)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

improving FPS is a tricky question… FPS is tied to your computer and how efficient your code is (it will be different for every game). if you share your program, i can try and give you some specific things you can try

---

<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:** [October 21, 2024, 10:34pm UTC](https://forum.makecode.com/t/arcade-mini-menu-extension/14368/53 "2024-10-21T22:34:25Z")

</div>

When a project gets laggy, I usually go around disabling bits and bobs here and there until my project gets smoother, which is how I find _why_ the project is laggy.  
Fixing it is another issue. Sometimes it’s something as simple as “Oh look! This codes sets an image to be exactly the same as it already was, repeatedly, in an on game update block! Guess I’d better change that lol”  
Other times it’s not so simple.  
The first thing I always look at is the fps monitor in the in-game menu. This will show you if the game starts up already laggy, or if some action causes lag to build up, like spawning a bunch of sprites that never get deleted when they go off screen (that’s a common one 😅).  
If you can identify which thing, or stack of things, is making your code laggy, it’s usually fairly simple to fix!

---

<div class="post-metadata">

**Author:** ![BlueYoshi507](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/blueyoshi507/32/32630_2.png) [@BlueYoshi507](https://forum.makecode.com/u/BlueYoshi507)\
**Post date:** [October 22, 2024, 4:37am UTC](https://forum.makecode.com/t/arcade-mini-menu-extension/14368/54 "2024-10-22T04:37:19Z")

</div>

@richard Here’s my code!

> **[Plants Vs. Zombies Retro](https://arcade.makecode.com/S70180-75834-29183-22906)**
>
> Made with ❤️ in Microsoft MakeCode Arcade.

You will see the new updates I made for it!

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [October 22, 2024, 4:51pm UTC](https://forum.makecode.com/t/arcade-mini-menu-extension/14368/55 "2024-10-22T16:51:03Z")

</div>

@BlueYoshi507 are you referring to the FPS of the blocks editor or the game? I’m not seeing any issues when playing your game in the browser.

---

<div class="post-metadata">

**Author:** ![BlueYoshi507](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/blueyoshi507/32/32630_2.png) [@BlueYoshi507](https://forum.makecode.com/u/BlueYoshi507)\
**Post date:** [October 22, 2024, 8:09pm UTC](https://forum.makecode.com/t/arcade-mini-menu-extension/14368/56 "2024-10-22T20:09:22Z")

</div>

@richard The Game. After I put like 2 rows of plants, the fps of the game start slowly going down and down until… EXTREME LAG!

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [October 22, 2024, 9:05pm UTC](https://forum.makecode.com/t/arcade-mini-menu-extension/14368/57 "2024-10-22T21:05:58Z")

</div>

hmmm, i’m still getting pretty good FPS with lots of plants:

![plantz](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/3/d/3d1db1693bed9010a6e2f0a1b5b6462432347253.gif)

but anyways i still see some parts of your code that can be optimized.

let’s take a look at your on game update; you have a lot of code that you are running every frame for every sprite of several sprite kinds. for example, let’s look at this chunk:

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

this code definitely does not need to be looping over every plant each frame. instead, consider setting the `grabbing plant` variable inside your button pressed and released events. also, store whatever plant is being grabbed in a variable so that you don’t need to loop over all of them to find which sprite you need to set the position on. then inside your `on game update` you can replace that code with something that looks like this:

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

alright, next up is this chunk of code:

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

definitely doesn’t need to happen every frame! instead, consider making an “on sun amount changed” function that you call every time you change the `sun amount` variable and put this code inside. you would also need to call that code wherever you set the `On?` property

finally, let’s look at this code:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/makecode/original/3X/a/8/a8e9655227bddad6af7aa058ec3429fcf5be91e9.png)

you only need to set these animations when you create the enemy sprite. not every frame

---

<div class="post-metadata">

**Author:** ![BlueYoshi507](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/blueyoshi507/32/32630_2.png) [@BlueYoshi507](https://forum.makecode.com/u/BlueYoshi507)\
**Post date:** [October 23, 2024, 4:13pm UTC](https://forum.makecode.com/t/arcade-mini-menu-extension/14368/58 "2024-10-23T16:13:47Z")

</div>

@richard can I use a “Forever” instead of a “Game Update” block?

---

<div class="post-metadata">

**Author:** ![richard](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/richard/32/5417_2.png) [@richard](https://forum.makecode.com/u/richard)\
**Post date:** [October 23, 2024, 4:44pm UTC](https://forum.makecode.com/t/arcade-mini-menu-extension/14368/59 "2024-10-23T16:44:32Z")

</div>

@BlueYoshi507 why do you want to use a forever block?

---

<div class="post-metadata">

**Author:** ![BlueYoshi507](https://sea2.discourse-cdn.com/flex020/user_avatar/forum.makecode.com/blueyoshi507/32/32630_2.png) [@BlueYoshi507](https://forum.makecode.com/u/BlueYoshi507)\
**Post date:** [October 23, 2024, 9:38pm UTC](https://forum.makecode.com/t/arcade-mini-menu-extension/14368/60 "2024-10-23T21:38:25Z")

</div>

@richard To always make those block work, but not make it happen every frame. I notice that the “Forever” has some mini-pauses (instead of every frame) when it’s working, so I though that maybe it could make the game have a better performance.

[Previous page](https://forum.makecode.com/t/arcade-mini-menu-extension/14368.md?page=2)

[Next page](https://forum.makecode.com/t/arcade-mini-menu-extension/14368.md?page=4)
