Tile

Tile

A Tile is an implementation of PlaceableObject which represents a static piece of artwork or prop within the Scene. Tiles are drawn above the BackroundLayer but below the TokenLayer.

Constructor

new Tile()

Source:
See:
Example
Tile.create({
  img: "path/to/tile-artwork.png",
  width: 300,
  height: 300,
  scale: 1,
  x: 1000,
  y: 1000,
  z: 370,
  rotation: 45,
  hidden: false,
  locked: true
});

Extends

Members

(static) layer

Source:

aspectRatio :number

Source:

Get the aspect ratio of the base texture for the Tile sprite

Type:
  • number

center :Object

Source:
Overrides:

The central coordinate pair of the placeable object based on it's own width and height

Type:
  • Object

controlIcon :ControlIcon

Source:
Inherited From:

A control icon for interacting with the object

Type:

coords :Array

Source:
Inherited From:

The [x,y] coordinates of the placeable object within the Scene container

Type:

data :Object

Source:
Overrides:

The underlying data object which provides the basis for this placeable object

Type:
  • Object

fov :PIXI.Polygon

Source:
Inherited From:

Track the field of vision for the placeable object. This is necessary to determine whether a player has line-of-sight towards a placeable object or vice-versa

Type:
  • PIXI.Polygon

id :string

Source:
Inherited From:

The EmbeddedDocument id of the underlying data object

Type:
  • string

layer :PlaceablesLayer

Source:
Inherited From:

Return a reference to the singleton layer instance which contains placeables of this type

Type:

owner :Boolean

Source:
Inherited From:

A Boolean flag for whether the current game User has permission to control this token

Type:
  • Boolean

scene :Scene

Source:
Inherited From:

Retain a reference to the Scene within which this Placeable Object resides

Type:

sheet :Application

Source:
Overrides:

A placeable object should define the logic to create

Type:

uuid :string

Source:
Inherited From:

A Universally Unique Identifier (uuid) for this Embedded Entity instance

Type:
  • string

Methods

clear()

Source:
Inherited From:

Clear the display of the existing object

clone() → {PlaceableObject}

Source:
Inherited From:

Clone the placeable object, returning a new object with identical attributes The returned object is non-interactive, and has no assigned ID If you plan to use it permanently you should call the create method

Returns:

A new object with identical data

Type
PlaceableObject

control(options) → {boolean}

Source:
Inherited From:

Assume control over a PlaceableObject, flagging it as controlled and enabling downstream behaviors

Parameters:
Name Type Description
options Object

Additional options which modify the control request

Properties
Name Type Description
releaseOthers boolean

Release any other controlled objects first

Returns:

A flag denoting whether or not control was successful

Type
boolean

(async) delete()

Source:
Inherited From:

displayToFront()

Source:
Inherited From:

Shift the display of the PlaceableObject to the top of the rendering stack, above all other siblings

(async) draw() → {PlaceableObject}

Source:
Overrides:

Draw the placeable object into its parent container

Returns:

A reference to the drawn object

Type
PlaceableObject

getFlag(scope, key) → {*}

Source:
Inherited From:

Get the value of a "flag" for this PlaceableObject See the setFlag method for more details on flags

Parameters:
Name Type Description
scope String

The flag scope which namespaces the key

key String

The flag key

Returns:

The flag value

Type
*

refresh() → {PlaceableObject}

Source:
Overrides:

Refresh the visual representation of the Placeable Object

Returns:

A reference to the refreshed object

Type
PlaceableObject

release(options) → {Boolean}

Source:
Inherited From:

Release control over a PlaceableObject, removing it from the controlled set

Parameters:
Name Type Description
options Object

Options which modify the releasing workflow

Returns:

A Boolean flag confirming the object was released.

Type
Boolean

(async) rotate(angle, snap) → {Promise}

Source:
Inherited From:

Rotate the PlaceableObject to a certain angle of facing

Parameters:
Name Type Description
angle number

The desired angle of rotation

snap number

Snap the angle of rotation to a certain target degree increment

Returns:

A Promise which resolves once the rotation has completed

Type
Promise

(async) setFlag(scope, key, value) → {Promise}

Source:
Inherited From:

Assign a "flag" to this Entity. Flags represent key-value type data which can be used to store flexible or arbitrary data required by either the core software, game systems, or user-created modules.

Each flag should be set using a scope which provides a namespace for the flag to help prevent collisions.

Flags set by the core software use the "core" scope. Flags set by game systems or modules should use the canonical name attribute for the module Flags set by an individual world should "world" as the scope.

Flag values can assume almost any data type. Setting a flag value to null will delete that flag.

Parameters:
Name Type Description
scope String

The flag scope which namespaces the key

key String

The flag key

value *

The flag value

Returns:

A Promise resolving to the updated PlaceableObject

Type
Promise

sortToBack()

Source:
Inherited From:

Sort the PlaceableObject to the back of the rendering stack, behind all other siblings. Update the database with the new minimal Z-index

sortToFront()

Source:
Inherited From:

Sort the PlaceableObject to the front of the rendering stack, above all other siblings. Update the database with the new maximal Z-index

(async) unsetFlag(scope, key) → {Promise}

Source:
Inherited From:

Remove a flag assigned to the Entity

Parameters:
Name Type Description
scope string

The flag scope which namespaces the key

key string

The flag key

Returns:

A Promise resolving to the updated Entity

Type
Promise

(async) update()

Source:
Inherited From: