Skip to content

LevelSelectionButton

Overview

LevelSelectionButton is a push button for selecting a game level. It is typically created by LevelSelectionButtonGroup. The original specification was done in https://github.com/phetsims/vegas/issues/59, but there have been numerous changes since then.

Note that LevelSelectionButton originally supported an optional 'best time' display. That display was intentionally removed from LevelSelectionButton, and from the level-selection user-interface in general, as the result of a design meeting on 10/15/2023. See https://github.com/phetsims/vegas/issues/120#issuecomment-1858310218.

@author John Blanco @author Chris Malley (PixelZoom, Inc.) @author Andrea Lin

Class LevelSelectionButton

import { LevelSelectionButton } from 'scenerystack/vegas';

Constructor

new LevelSelectionButton( icon : Node, scoreProperty : TProperty<number>, providedOptions? : LevelSelectionButtonOptions )

Instance Methods

dispose()

Static Methods

createSizedImageNode( icon : Node, size : Dimension2 ) : Node

Creates a new icon with specific dimensions. The provided icon is scaled to fit, and a background with the specified size is added to ensure that the size of the returned Node is correct.

Type LevelSelectionButtonOptions

import type { LevelSelectionButtonOptions } from 'scenerystack/vegas';
  • buttonWidth?: number
    Used to size the content
  • buttonHeight?: number
  • createScoreDisplay?: ( scoreProperty: TProperty<number> ) => Node
    score display
  • scoreDisplayProportion?: number
  • scoreDisplayMinXMargin?: number
  • scoreDisplayMinYMargin?: number
  • iconToScoreDisplayYSpace?: number
  • soundPlayerIndex?: number
    Configures the soundPlayer for a specific game level. Note that this assumes zero-based indexing for game level, which is often not the case. This option is ignored if RectangularPushButtonOptions.soundPlayer is provided.
  • & StrictOmit<RectangularPushButtonOptions, "content">

Source Code

See the source for LevelSelectionButton.ts in the vegas repository.