Class: Token

Token

new Token(owner, tile, coloropt)

A Token class
Parameters:
Name Type Attributes Default Description
owner string The player who owns this token.
tile Tile The tile where the token is being placed
color string <optional>
COLOR_BLACK Token color. See constants.js.
Source:

Extends

Methods

destroy() → {void}

Remove the token from the board and player
Source:
Returns:
Type
void

moveToTile(tile) → {void}

Move a token from one tile to another
Parameters:
Name Type Description
tile Tile tile to move to
Source:
Returns:
Type
void

sendMessage(message) → {void}

Method to broadcast a message out to the other components
Parameters:
Name Type Description
message string Message to send
Inherited From:
Source:
Returns:
Type
void

setTile(tile) → {void}

Set the token's tile
Parameters:
Name Type Description
tile Tile the tile where the token sits
Source:
Returns:
Type
void

subscribe(callback) → {void}

Method to subscribe to messages
Parameters:
Name Type Description
callback func A callback method to pass the message to
Inherited From:
Source:
Returns:
Type
void