Beep8 logo

Menu Documentation

Menu Documentation Source Code

Menu Methods

beep8.Menu.display(choices [,options]) async

Displays a menu with the given choices and returns the index of the selected choice.

Displaying a menu will pause the execution of other elements of your game until a choice has been made.

The menu automatically beeps and boops as the player navigates through the choices.

The options object can contain the following properties:

  • options.title - The title of the menu.
  • options.prompt - The prompt to display above the choices.
  • options.selBgColor - The background color of the selected choice. Defaults to the current foreground colour.
  • options.selFgColor - The foreground color of the selected choice. Defaults to the current background colour.
  • options.bgChar - The character to use for the background.
  • options.borderChar - The character to use for the border.
  • options.center - Whether to center the menu horizontally and vertically.
  • options.centerH - Whether to center the menu horizontally.
  • options.centerV - Whether to center the menu vertically.
  • options.padding - The padding around the prompt and choices.
  • options.selIndex - The index of the initially selected choice.
  • options.cancelable - Whether the menu can be canceled with the Escape key.

Parameters

  • choices (string[]): The choices to display.
  • [options] (object): Options for the menu.

Returns

  • (*Promise*): A promise that resolves to the index of the selected choice.

More Beep8 Docs

Actors Documentation

Async Documentation

Core Functions

Input Documentation

App Intro Documentation

Joystick Documentation

Menu Documentation

Music Documentation

Passcodes Documentation

Public API

Random Numbers Documentation

SFX Documentation

Tilemap Documentation

Utilities Documentation