QuantityBar

Bar that adjusts the size of a static sprite based on a value. This is done by masking the sprite and then resizing the mask.

new QuantityBar(game: Object, xy: Object, values: Object, vertical: boolean, reverse: boolean, trackImage: string, barImage: string, tweenParams: Object)

Extends Bar

Parameters
game (Object) Current game instance.
xy (Object) Dictionary with the values for the bar's x and y position.
values (Object) The numerical values for the bar.
vertical (boolean) Determines if the bar should be vertical or horizontal.
reverse (boolean) Determines the direction the bar moves when adjusted.
trackImage (string) The image key to use for the track.
barImage (string) The image key to use for the bar. Will automatically resize to fit.
tweenParams (Object) Object with duration and easing function for the scrolling tween.
Instance Members
adjustBar(newValue)

QuantityRange

Used by a QuantityBar to hold the bar's values.

new QuantityRange(bar: number, startValue: number, maxValue: number)
Parameters
bar (number) The QuantityBar object that uses the range.
startValue (number) The initial value for the bar.
maxValue (number) The maximum value the bar can have.
Instance Members
getRatio()
getCurrentValue()

ValueRange

Used by a ValueBar to hold the bar's values.

new ValueRange(step: number, startValue: number, maxValue: number)
Parameters
step (number) The amount the bar is changed by.
startValue (number) The initial value for the bar.
maxValue (number) The maximum value the bar can have.
Instance Members
adjustValue(newValue)
getCurrentValue()

ViewportRange

Used by a Scrollbar to hold the values and adjust a viewport's position.

new ViewportRange(viewport: Object, vertical: boolean)
Parameters
viewport (Object) The viewport to adjust.
vertical (boolean) If the viewport is vertical or horizontal.
Instance Members
adjustValue(newValue)

Scrollbar

A bar that moves along a track. The bar is resized relative to the size of the track and size of the content to be scrolled.

new Scrollbar(game: Object, content: Object, draggable: boolean, vertical: boolean, trackImage: string, barImage: string, tweenParams: Object)

Extends DraggableBar

Parameters
game (Object) Current game instance.
content (Object) Anything that you want to move via the scrollbar.
draggable (boolean) Determines if the scrollbar responds to mouse clicks.
vertical (boolean) Determines if the scrollbar should be vertical or horizontal.
trackImage (string) The image key to use for the track.
barImage (string) The image key to use for the bar. Will automatically resize to fit.
tweenParams (Object) Object with duration and easing function for the scrolling tween.

ValueBar

Bar that adjusts a number. This is done by masking the sprite and then resizing the mask.

new ValueBar(game: Object, xy: Object, values: Object, draggable: boolean, vertical: boolean, trackImage: string, barImage: string, tweenParams: Object)

Extends DraggableBar

Parameters
game (Object) Current game instance.
xy (Object) Dictionary with the values for the bar's x and y position.
values (Object) The numerical values for the bar.
draggable (boolean) Determines if the scrollbar responds to mouse clicks.
vertical (boolean) Determines if the bar should be vertical or horizontal.
trackImage (string) The image key to use for the track.
barImage (string) The image key to use for the bar. Will automatically resize to fit.
tweenParams (Object) Object with duration and easing function for the scrolling tween.
Instance Members
setDraggableArea()
setTrackScrollAreaSize()
setInitialBarPosition()
getClosestPosition()
snapToClosestPosition()

TextSprite

Sprite with text added as a child.

new TextSprite(game: Object, x: number, y: number, key: string)

Extends Phaser.Group

Parameters
game (Object) Current game instance.
x (number) The x coordinate on screen where the textSprite will be placed.
y (number) The y coordinate on screen where the textSprite will be placed.
key (string) The image to create a sprite with.

TextButton

Phaser Group containing a button with text anchored in the button's center.

new TextButton(game: Object, x: number, y: number, key: string, callback: Object, callbackContext: Object, overKey: number, outKey: number, downKey: number, upKey: number)

Extends Phaser.Group

Parameters
game (Object) Current game instance.
x (number) The x coordinate on screen where the textSprite will be placed.
y (number) The y coordinate on screen where the textSprite will be placed.
key (string) The image to create a sprite with.
callback (Object) Callback to use when the button is clicked.
callbackContext (Object) The context the callback is called in.
overKey (number) The frame to switch to when an over event is triggered.
outKey (number) The frame to switch to when an out event is triggered.
downKey (number) The frame to switch to when a down event is triggered.
upKey (number) The frame to switch to when an up event is triggered.
Instance Members
eventTextYAdjustment(number)

Column

Frame that places new child nodes directly under the previous child.

new Column(game: Object, x: Number, y: Number, bg: string, modal: boolean)

Extends Frame

Parameters
game (Object) Current game instance.
x (Number = 0) The x position of the Column.
y (Number = 0) The y position of the Column.
bg (string = null) The background image to use.
modal (boolean = false) If the Column should block external interaction until killed.

Frame

Group with a dedicated background image.

new Frame(game: Object, x: number, y: number, bg: string, modal: boolean)

Extends Phaser.Group

Parameters
game (Object) Current game instance.
x (number = 0) The x position of the Frame.
y (number = 0) The y position of the Frame.
bg (string = null) The background image to use.
modal (boolean = false) If the Frame should block external interaction until killed.
Instance Members
dismiss()
addNode(node, paddingX, paddingY, alignment)

Row

Frame that places new child nodes directly next to the previous child.

new Row(game: Object, x: Number, y: Number, bg: string, modal: boolean)

Extends Frame

Parameters
game (Object) Current game instance.
x (Number = 0) The x position of the Row.
y (Number = 0) The y position of the Row.
bg (string = null) The background image to use.
modal (boolean = false) If the Row should block external interaction until killed.

Viewport

A container with a limited viewable area. Uses a mask to hide children outside of the specified x/y/width/height area. Content outside the viewport has their input disabled.

new Viewport(game: Object, x: number, y: number, width: number, height: number)

Extends PhaserObjects.Group

Parameters
game (Object) Current game instance.
x (number) The x coordinate on screen where the viewport will be placed.
y (number) The y coordinate on screen where the viewport will be placed.
width (number) The width of the viewport.
height (number) The height of the viewport.
Instance Members
addNode(node)
disableOutOfBounds(children, context, vertical)

KeyboardGroup

Collection of sprites that can be selected with the keyboard. When the select key is hit, the sprite that was selected is now connected to the keyboard.

new KeyboardGroup(game: Object, vertical: Boolean, callbackContext: Object)
Parameters
game (Object) Current game instance.
vertical (Boolean) If the selection should be controlled with up/down or left/right arrow keys.
callbackContext (Object) The context for the previous and next Events.
Instance Members
addNode(newNode)
prevItem()
nextItem()

Wheel3D

A Wheel of sprites where each item's position is projected in 3D space. The number of points is automatically determined by the number of items.

new Wheel3D(game: Object, xy: any, sprites: array, firstPlace: Number, zoom: Number, axis: String, rotations: Object, visibleRange: Object, tweenParams: Object)
Parameters
game (Object) Reference to current game instance.
xy (any)
sprites (array) List of sprites to use in the wheel.
firstPlace (Number) Determines which position on the wheel is the active one.
zoom (Number) Determines how far to project the points.
axis (String) The axis the wheel3D places items around.
rotations (Object) Axis and angle to rotate the entire wheel after the initial projection.
visibleRange (Object) Determines which items on the wheel should be visible. If none provided, assumes all items should be visible.
tweenParams (Object) Array with the duration and easing function for the movement tween.
Instance Members
moveBack()
moveForward()
project()
dispatchOnStart()
dispatchOnComplete()
enableMoving()
updatePosition(operator)
resetAngle()