Constructs a new Tileset.
The asset this object is part of, or null
.
The type of this asset.
Background color for this tileset in the Tilesets view.
Whether this tileset is a collection of images (same as checking whether image is an empty string).
The number of tile columns in this tileset.
Can be changed in case of image-collection tilesets, in which case it determines the number of columns used in the tileset view when dynamic wrapping is disabled.
File name of the asset.
The signal emitted when fileName changes.
Its first parameter is the new file name, the second parameter is the old file name.
The fill mode to use when rendering tiles from this tileset. Only relevant when the tiles are not rendered at their native size.
The file name of the image used by this tileset. Empty in case of image collection tilesets.
Height of the tileset image in pixels.
Size of the tileset image in pixels.
Width of the tileset image in pixels.
Whether this tileset is a collection of images (same as checking whether image is an empty string).
Whether the asset is a TileMap.
Whether the asset is a Tileset.
Margin around the tileset in pixels (only used at the top and left sides of the tileset image).
Whether the asset was modified after it was saved or loaded.
The signal emitted when modified changes.
Name of the tileset.
The ID of the next tile that would be added to this tileset. All existing tiles have IDs that are lower than this ID.
The alignment to use for tile objects (when Unspecified, uses Bottom alignment on isometric maps and BottomLeft alignment for all other maps).
The orientation of this tileset (used when rendering overlays and in the tile collision editor).
Whether the object is read-only.
Selected tiles in the tileset editor.
See TilesetsView.selectedTiles for getting the selected tiles in the Tilesets view.
The number of tiles in this tileset.
Tile Height for tiles in this tileset in pixels.
Offset in pixels that is applied when tiles from this tileset are rendered.
The size to use when rendering tiles from this tileset on a tile layer.
Tile size for tiles in this tileset in pixels.
Spacing between tiles in this tileset in pixels.
Tile width for tiles in this tileset in pixels.
Array of all tiles in this tileset. Note that the index of a tile in this array does not always match with its ID.
Color used as transparent color when rendering tiles from this tileset.
This property is currently not supported for image collection tilesets.
Array of all Wang sets in this tileset.
Adds a new tile to this tileset and returns it. Only works for image collection tilesets.
Add a new Wang set to this tileset with the given name and type.
Returns a reference to the tile with the given ID, or null
if no such tile exists. When the tile gets removed from the tileset, the reference changes to a standalone copy of the tile.
Note that the tiles in a tileset are only guaranteed to have consecutive IDs for tileset-image based tilesets. For image collection tilesets there will be gaps when tiles have been removed from the tileset.
Creates the tiles in this tileset by cutting them out of the given image, using the current tile size, tile spacing and margin parameters. These values should be set before calling this function.
Optionally sets the source file of the image. This may be useful, but be careful since Tiled will try to reload the tileset from that source when the tileset parameters are changed.
Creates a single undo command that wraps all changes applied to this asset by the given callback. Recommended to avoid spamming the undo stack with small steps that the user does not care about.
Example function that changes visibility of multiple layers in one step:
tileMap.macro((visible ? "Show" : "Hide") + " Selected Layers", function() {
tileMap.selectedLayers.forEach(function(layer) {
layer.visible = visible
})
})
The returned value is whatever the callback function returned.
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).
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.
Redoes the last change that was undone.
Removes the custom property with the given name.
Removes the given tiles from this tileset. Only works for image collection tilesets.
Removes the given Wang set from this tileset.
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.
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.
Save this asset to disk. Returns true if the asset was saved successfully.
Errors are reported by the UI. When an editor is open for this asset, this editor is activated when an error is reported.
Only supported with the editor running, not when running scripts on the CLI. Also, the asset should already have an associated file.
To save assets to a specific file or in a different format, use tiled.mapFormat or tiled.tilesetFormat. This is currently not supported for worlds.
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".
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.
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.
Replaces all currently set custom properties with a new set of properties.
Sets the value of the custom property with the given name.
Supported types are bool
, number
, string
, color,
FilePath, ObjectRef, MapObject and
PropertyValue.
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.
Sets the tile size for this tileset. If an image has been specified as well, the tileset will be (re)loaded. Can’t be used on image collection tilesets.
Returns a reference to the tile with the given ID. Raises an error if no such tile exists. When the tile gets removed from the tileset, the reference changes to a standalone copy of the tile.
Note that the tiles in a tileset are only guaranteed to have consecutive IDs for tileset-image based tilesets. For image collection tilesets there will be gaps when tiles have been removed from the tileset.
Undoes the last applied change.
Generated using TypeDoc
A container for tiles that can be used by a map.
Can contain either tiles cut from a single image, by setting image or calling loadFromImage, or individual tiles using addTile and then setting the image on each tile using Tile.imageFileName or Tile.setImage.