Button

new game.Button(asset, x, y, callback)

Parameters:

  • asset Texture|String

    Asset or texture to use as the button

  • x Number

    X position of the button

  • y Number

    Y position of the button

  • callback Function

    Function that is called, when the button is clicked

Properties

callback Function (Default: null)

Function that is called, when the button is clicked

clickSound String (Default: null)

Name of the sound to play, when clicking the button

disableAlpha Number (Default: 0.5)

Alpha value, when button is disabled

fadeSpeed Number (Default: 500)

How fast to fade the button (ms)

rotateAmount Number (Default: 0.1)

How much to rotate the button (radians)

rotateEasing String (Default: Quadratic.InOut)

Easing to use, when rotating the button

rotateSpeed Number (Default: 1000)

How fast to rotate the button (ms)

scaleAmount Number (Default: 0.1)

How much to scale the button

scaleEasing String (Default: Back.Out)

Easing to use, when scaling the button

scaleSound String (Default: null)

Name of the sound to play, when scaling the button

scaleSpeed Number (Default: 250)

How fast to tween the scaling

Methods

_click()

(No description yet)

_fadeInComplete()

(No description yet)

_fadeOutComplete()

(No description yet)

_mousedown()

(No description yet)

_mouseup()

(No description yet)

_onScaleInStart()

(No description yet)

_scaleInEnd()

(No description yet)

addTo(container)

(No description yet)

Parameters:

  • container Container
disable()

(No description yet)

enable()

(No description yet)

fadeIn(delay)

(No description yet)

Parameters:

  • delay Number

    How much to wait before fading

fadeOut(delay, hide)

(No description yet)

Parameters:

  • delay Number

    How much to wait before fading

  • hide Boolean

    Hide the button after fading

remove()

(No description yet)

rotate(random)

(No description yet)

Parameters:

  • random Boolean

    Start from random position

scaleIn(delay)

(No description yet)

Parameters:

  • delay Number

    How much to wait before scaling

Attributes

clickSound String (Default: null)

Default click sound for all buttons

scaleSound String (Default: null)

Default scale sound for all buttons