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) embeddedName

Source:

aspectRatio :number

Source:

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

Type:
  • number

center :PIXI.Point

Source:
Overrides:

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

Type:
  • PIXI.Point

controlIcon :ControlIcon

Source:
Overrides:

A control icon for interacting with the object

Type:

data :Object

Source:
Overrides:

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

Type:
  • Object

fov :PIXI.Polygon|null

Source:
Overrides:

The field-of-vision polygon for the object, if it has been computed

Type:
  • PIXI.Polygon | null

frame :PIXI.Container|null

Source:

The Tile border frame

Type:
  • PIXI.Container | null

id :string

Source:
Overrides:

The _id of the underlying EmbeddedEntity

Type:
  • string

los :PIXI.Polygon|null

Source:
Overrides:

The line-of-sight polygon for the object, if it has been computed

Type:
  • PIXI.Polygon | null

mouseInteractionManager :MouseInteractionManager

Source:
Overrides:

A mouse interaction manager instance which handles mouse workflows related to this object.

Type:

scene :Scene

Source:
Overrides:

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

Type:

sheet :FormApplication

Source:
Overrides:

A Form Application which is used to configure the properties of this Placeable Object or the EmbeddedEntity it represents.

Type:

texture :PIXI.Texture|null

Source:

The primary tile image texture

Type:
  • PIXI.Texture | null

tile :PIXI.Container|null

Source:

The Tile image container

Type:
  • PIXI.Container | null

uuid :string

Source:
Overrides:

A Universally Unique Identifier (uuid) for this EmbeddedEntity

Type:
  • string

vision :Object

Source:
Overrides:

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:
  • Object

Methods

(static) createPreview() → {Tile}

Source:

Create a preview tile with a background texture instead of an image

Returns:
Type
Tile

_updateRotation(angleopt, deltaopt, snapopt) → {number}

Source:
Overrides:

Determine a new angle of rotation for a PlaceableObject either from an explicit angle or from a delta offset.

Parameters:
Name Type Attributes Description
angle number <optional>

An explicit angle, either this or delta must be provided

delta number <optional>

A relative angle delta, either this or the angle must be provided

snap number <optional>

A precision (in degrees) to which the resulting angle should snap. Default is 0.

Returns:

The new rotation angle for the object

Type
number

activateListeners()

Source:
Overrides:

Activate interactivity for the Placeable Object

can(user, action) → {boolean}

Source:
Overrides:

Test whether a user can perform a certain interaction with regards to a Placeable Object

Parameters:
Name Type Description
user User

The User performing the action

action string

The named action being attempted

Returns:

Does the User have rights to perform the action?

Type
boolean

clear() → {PlaceableObject}

Source:
Overrides:

Clear the display of the existing object

Returns:

The cleared object

Type
PlaceableObject

clone() → {PlaceableObject}

Source:
Overrides:

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:
Overrides:

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:
Overrides:

(async) draw() → {PlaceableObject}

Source:
Overrides:

Draw the placeable object into its parent container

Returns:

The drawn object

Type
PlaceableObject

getFlag(scope, key) → {*}

Source:
Overrides:

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 current display state of the Placeable Object

Returns:

The refreshed object

Type
PlaceableObject

release(options) → {Boolean}

Source:
Overrides:

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.<PlaceableObject>}

Source:
Overrides:

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.<PlaceableObject>

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

Source:
Overrides:

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

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

Source:
Overrides:

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:
Overrides: