# Best practice for miniature menus

**URL:** <https://phaser.discourse.group/t/best-practice-for-miniature-menus/4634>\
**Category:** Phaser 3\
**Created:** [December 17, 2019, 7:30pm UTC](https://phaser.discourse.group/t/best-practice-for-miniature-menus/4634 "2019-12-17T19:30:56Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![robertkofoed](https://avatars.discourse-cdn.com/v4/letter/r/97f17d/32.png) [@robertkofoed](https://phaser.discourse.group/u/robertkofoed)\
**Post date:** [December 17, 2019, 7:30pm UTC](https://phaser.discourse.group/t/best-practice-for-miniature-menus/4634/1 "2019-12-17T19:30:56Z")

</div>

Hello, What is the best way & best practice of creating a mini-menu at the mouse or wherever? Im creating a TowerDefense and I want to popup a menu when I select a tile. How do you usually build this sort of thing?

Thx

---

<div class="post-metadata">

**Author:** ![Villan](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/villan/32/2920_2.png) [@Villan](https://phaser.discourse.group/u/Villan)\
**Post date:** [December 17, 2019, 8:52pm UTC](https://phaser.discourse.group/t/best-practice-for-miniature-menus/4634/2 "2019-12-17T20:52:32Z")

</div>

I’d probably just make it’s own scene and bring it to the top and make your selections and then send the scene to the back.

---

<div class="post-metadata">

**Author:** ![fselcukcan](https://avatars.discourse-cdn.com/v4/letter/f/b5a626/32.png) [@fselcukcan](https://phaser.discourse.group/u/fselcukcan)\
**Post date:** [December 17, 2019, 10:03pm UTC](https://phaser.discourse.group/t/best-practice-for-miniature-menus/4634/3 "2019-12-17T22:03:22Z")

</div>

In addition to make them with scenes plugins can be used as well. One can write own plugin to do that.

However, I am not sure, if it is necessary not for your case, if a plugin can stop/pause/sleep the scene it is open from. That would be strange because if it stop/pause/sleep what is left to show/work something. I would like to know about that.

---

<div class="post-metadata">

**Author:** ![snowbillr](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/snowbillr/32/332_2.png) [@snowbillr](https://phaser.discourse.group/u/snowbillr)\
**Post date:** [December 18, 2019, 3:06pm UTC](https://phaser.discourse.group/t/best-practice-for-miniature-menus/4634/4 "2019-12-18T15:06:58Z")

</div>

I haven’t built one before, but I’d probably approach it somewhat like this:

- build a ContextMenu class that takes in a list of ContextMenuItems. the ContextMenu would be responsible for displaying the context menu items and calling their callbacks when they are selected
- define the list of ContextMenuItems that each selectable tile should have
- when the selectable tile is selected, create/show the ContextMenu for the tile’s ContextMenuItems

---

<div class="post-metadata">

**Author:** ![samme](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/samme/32/5275_2.png) [@samme](https://phaser.discourse.group/u/samme)\
**Post date:** [December 18, 2019, 7:03pm UTC](https://phaser.discourse.group/t/best-practice-for-miniature-menus/4634/5 "2019-12-18T19:03:46Z")

</div>

Maybe see [https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-menu/](https://rexrainbow.github.io/phaser3-rex-notes/docs/site/ui-menu/).

---

<div class="post-metadata">

**Author:** ![fselcukcan](https://avatars.discourse-cdn.com/v4/letter/f/b5a626/32.png) [@fselcukcan](https://phaser.discourse.group/u/fselcukcan)\
**Post date:** [December 18, 2019, 7:41pm UTC](https://phaser.discourse.group/t/best-practice-for-miniature-menus/4634/6 "2019-12-18T19:41:59Z")

</div>

Do you mean to create a class extends `Phaser. Scene`?

---

<div class="post-metadata">

**Author:** ![snowbillr](https://yyz2.discourse-cdn.com/free1/user_avatar/phaser.discourse.group/snowbillr/32/332_2.png) [@snowbillr](https://phaser.discourse.group/u/snowbillr)\
**Post date:** [December 18, 2019, 7:56pm UTC](https://phaser.discourse.group/t/best-practice-for-miniature-menus/4634/7 "2019-12-18T19:56:14Z")

</div>

Not necessarily. I’m saying create a JavaScript class to hold the responsibility of displaying the context menu and its items, and handle its interactivity. Whether that’s a class that extends a scene or not, or is a class that extends some type of gameobject or not, or doesn’t extend anything and holds all its data in instance variables, it doesn’t matter. This was just a suggestion on how to organize the logic.

Maybe I should have been more explicit that I wasn’t giving exact implementation details, but more of a suggestion on design.

---

<div class="post-metadata">

**Author:** ![fselcukcan](https://avatars.discourse-cdn.com/v4/letter/f/b5a626/32.png) [@fselcukcan](https://phaser.discourse.group/u/fselcukcan)\
**Post date:** [December 18, 2019, 8:01pm UTC](https://phaser.discourse.group/t/best-practice-for-miniature-menus/4634/8 "2019-12-18T20:01:49Z")

</div>

> [@fselcukcan](#):
>
> However, I am not sure, if it is necessary not for your case, if a plugin can stop/pause/sleep the scene it is open from

I am also concerned about this. What are your thoughts about that point regarding opening modals, dialogs, menus etc over a game scene?
