Options
All
  • Public
  • Public/Protected
  • All
Menu

Defines a "Terrain Set".

To create and add a new Wang set to a Tileset, use Tileset.addWangSet.

since

1.5

Hierarchy

Index

Constructors

constructor

Properties

Readonly asset

asset: null | Asset

The asset this object is part of, or null.

className

className: string

Class name of the object.

Replaced the "type" of MapObject and Tile in Tiled 1.9.

since

1.9

colorCount

colorCount: number

The number of colors used by this Wang set.

imageTile

imageTile: Tile

The tile used to represent the Wang set.

name

name: string

Name of the Wang set.

Readonly readOnly

readOnly: boolean

Whether the object is read-only.

Readonly tileset

tileset: Tileset

The tileset to which this Wang set belongs.

type

type: typeof Edge | typeof Corner | typeof Mixed

Type of the Wang set.

Static Readonly Corner

Corner: typeof Corner

Static Readonly Edge

Edge: typeof Edge

Static Readonly Mixed

Mixed: typeof Mixed

Methods

colorName

  • colorName(colorIndex: number): string
  • Returns the name of the Wang color at the given index.

    since

    1.8

effectiveTypeForColor

  • effectiveTypeForColor(color: number): typeof Edge | typeof Corner | typeof Mixed
  • Returns the effective WangSet type for the given color.

    Always equals the type of the WangSet in case of corner or edge sets. In case of a mixed set, it could also be WangSet.Corner or WangSet.Edge, when the given color is only used in that context.

    since

    1.10.2

properties

  • Returns all custom properties set on this object.

    Modifications to the properties will not affect the original object. Does not include inherited values (see resolvedProperties).

property

  • Returns the value of the custom property with the given name, or undefined if no such property is set on the object. Does not include inherited values (see resolvedProperty).

    file properties are returned as FilePath.

    object properties are returned as MapObject when possible, or ObjectRef when the object could not be found.

removeProperty

  • removeProperty(name: string): void

resolvedProperties

  • Returns all custom properties set on this object. Modifications to the properties will not affect the original object. Includes values inherited from object types, templates and tiles where applicable.

resolvedProperty

  • Returns the value of the custom property with the given name, or undefined if no such property is set. Includes values inherited from object types, templates and tiles where applicable.

setColorName

  • setColorName(colorIndex: number, name: string): void
  • Sets the name of the Wang color at the given index.

    since

    1.8

setColorProperty

  • setColorProperty(name: string, value: color): void
  • setColorProperty(name: string, red: number, green: number, blue: number, alpha?: number): void
  • Sets the value of the custom property with the given name to the given color value.

    The color is specified as a string "#RGB", "#RRGGBB" or "#AARRGGBB".

    since

    1.10

    deprecated

    Use setProperty with a value created by tiled.color instead.

  • Sets the value of the custom property with the given name to the given color value.

    The color is specified by its red, green, blue and alpha components. Each component takes a value from 0 to 255. When not provided, the alpha defaults to 255.

    since

    1.10

    deprecated

    Use setProperty with a value created by tiled.color instead.

setFloatProperty

  • setFloatProperty(name: string, value: number): void
  • Sets the value of the custom property with the given name to the given float value.

    This function is provided as alternative to setProperty, since that function will set whole numbers as int properties.

    since

    1.10

setProperties

setProperty

  • Sets the value of the custom property with the given name.

    Supported types are bool, number, string, color, FilePath, ObjectRef, MapObject and PropertyValue.

    note

    When setting a number, the property type will be set to either int or float, depending on whether it is a whole number. To force the property to be float, use setFloatProperty.

  • Sets the value of an object's property identified by the given path to the given value.

    The path is a list of property names, where each name identifies a member of the previous member's value. The last name in the list identifies the property to set.

    Supported types are bool, number, string, color, FilePath, ObjectRef, MapObject and PropertyValue.

    note

    When setting a number, the property type will be set to either int or float, depending on whether it is a whole number. To force the property to be float, use setFloatProperty.

    since

    1.11

setWangId

  • setWangId(tile: Tile, wangId: number[]): void
  • Sets the Wang ID associated with the given tile.

    The Wang ID is given by an array of 8 numbers, indicating the colors associated with each index in the following order: [Top, TopRight, Right, BottomRight, Bottom, BottomLeft, Left, TopLeft] (see WangIndex). A value of 0 indicates that no color is associated with a given index.

    Make sure the Wang set color count is set before calling this function, because it will raise an error when the Wang ID refers to non-existing colors.

wangId

  • wangId(tile: Tile): number[]
  • Returns the current Wang ID associated with the given tile.

    The Wang ID is given by an array of 8 numbers, indicating the colors associated with each index in the following order: [Top, TopRight, Right, BottomRight, Bottom, BottomLeft, Left, TopLeft] (see WangIndex). A value of 0 indicates that no color is associated with a given index.

Generated using TypeDoc