An Image Collection is a special Tile Set containing multiple images, with no slicing into each image.
Image Collections are normally created automatically when Tiled data is loaded.
new ImageCollection(name, firstgid, [width], [height], [margin], [spacing], [properties])
name | type | arguments | Default | description |
---|---|---|---|---|
name | string |
The name of the image collection in the map data. |
||
firstgid | number |
The first image index this image collection contains. |
||
width | number | <optional> | 32 |
Width of widest image (in pixels). |
height | number | <optional> | 32 |
Height of tallest image (in pixels). |
margin | number | <optional> | 0 |
The margin around all images in the collection (in pixels). |
spacing | number | <optional> | 0 |
The spacing between each image in the collection (in pixels). |
properties | object | <optional> | {} |
Custom Image Collection properties. |
The Tiled firstgid value. This is the starting index of the first image index this Image Collection contains.
The height of the tallest image (in pixels).
The margin around the images in the collection (in pixels).
Use setSpacing
to change.
The spacing between each image in the collection (in pixels).
Use setSpacing
to change.
The width of the widest image (in pixels).
The cached images that are a part of this collection.
The name of the Image Collection.
Image Collection-specific properties that are typically defined in the Tiled editor.
The total number of images in the image collection.
Add an image to this Image Collection.
name | type | description |
---|---|---|
gid | number |
The gid of the image in the Image Collection. |
image | string |
The the key of the image in the Image Collection and in the cache. |
This ImageCollection object.
Returns true if and only if this image collection contains the given image index.
name | type | description |
---|---|---|
imageIndex | number |
The image index to search for. |
True if this Image Collection contains the given index.