Options
All
  • Public
  • Public/Protected
  • All
Menu

Class MapObject

Hierarchy

Index

Constructors

constructor

Properties

Readonly asset

asset: Asset

The asset this object is part of, or null.

font

font: Font

The font of a text object.

height

height: number

Height of the object in pixels.

Readonly id

id: number

Unique (map-wide) ID of the object.

layer

Layer this object is part of (or null in case of a standalone object).

Readonly map

map: TileMap

Map this object is part of (or null in case of a standalone object).

name

name: string

Name of the object.

polygon

polygon: Polygon

Polygon of the object.

pos

pos: point

Position of the object in pixels.

Readonly readOnly

readOnly: boolean

Whether the object is read-only.

rotation

rotation: number

Rotation of the object in degrees clockwise.

selected

selected: boolean

Whether the object is selected.

shape

shape: typeof Rectangle | typeof Polygon | typeof Polyline | typeof Ellipse | typeof Text | typeof Point

Shape of the object.

size

size: size

Size of the object in pixels.

text

text: string

The text of a text object.

textAlignment

textAlignment: number

The alignment of a text object.

textColor

textColor: color

Color of a text object.

tile

tile: Tile

Tile of the object.

tileFlippedHorizontally

tileFlippedHorizontally: boolean

Whether the tile is flipped horizontally.

tileFlippedVertically

tileFlippedVertically: boolean

Whether the tile is flipped vertically.

type

type: string

Type of the object.

visible

visible: boolean

width

width: number

Width of the object in pixels.

wordWrap

wordWrap: boolean

Whether the text of a text object wraps based on the width of the object.

x

x: number

X coordinate of the object in pixels.

y

y: number

Y coordinate of the object in pixels.

Static Readonly Ellipse

Ellipse: typeof Ellipse

Static Readonly Point

Point: typeof Point

Static Readonly Polygon

Polygon: typeof Polygon

Static Readonly Polyline

Polyline: typeof Polyline

Static Readonly Rectangle

Rectangle: typeof Rectangle

Static Readonly Text

Text: typeof Text

Methods

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.

setProperties

setProperty

  • Sets the value of the custom property with the given name. Supported types are bool, number, string, FilePath, ObjectRef and MapObject.

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

    note

    Support for setting color properties is currently missing.

Generated using TypeDoc