Class: Sprite_Button

Sprite_Button()

new Sprite_Button()

The sprite for displaying a button.

Extends

Methods

callClickHandler(height)

Calls the handler method bound to the button.
Parameters:
Name Type Description
height function

canvasToLocalX(x) → {number}

Changes the x coordinate of the screen to local sprite x coordinate.
Parameters:
Name Type Description
x Number
Returns:
Type
number

canvasToLocalY(y) → {number}

Changes the y coordinate of the screen to local sprite y coordinate.
Parameters:
Name Type Description
y Number
Returns:
Type
number

initialize()

isActive() → {boolean}

Returns true if the sprite button is currently active.
Returns:
Type
boolean

isButtonTouched() → {boolean}

Returns true is the button is presently being touched.
Returns:
Type
boolean

processTouch()

Processes weather or not the button is being touched and calls the handler bound to the button.

setClickHandler(height)

Creates a new handler and binds it to the button.
Parameters:
Name Type Description
height function

setColdFrame(x, y, width, height)

Set the button sprites cold frame.
Parameters:
Name Type Description
x Number
y Number
width Number
height Number

setHotFrame(x, y, width, height)

Set the button sprites hot frame
Parameters:
Name Type Description
x Number
y Number
width Number
height Number

update()

updateFrame()

Update method, which checks if the sprite is being touched and updates the current frame.