new ImageCollection(name, firstgid, width, height, margin, spacing, properties)
An Image Collection is a special tileset containing mulitple images, with no slicing into each image.
Image Collections are normally created automatically when Tiled data is loaded.
Parameters:
Name | Type | Argument | Default | Description |
---|---|---|---|---|
name |
string | The name of the image collection in the map data. |
||
firstgid |
integer | The first image index this image collection contains. |
||
width |
integer |
<optional> |
32 | Width of widest image (in pixels). |
height |
integer |
<optional> |
32 | Height of tallest image (in pixels). |
margin |
integer |
<optional> |
0 | The margin around all images in the collection (in pixels). |
spacing |
integer |
<optional> |
0 | The spacing between each image in the collection (in pixels). |
properties |
object |
<optional> |
{} | Custom Image Collection properties. |
- Source - tilemap/ImageCollection.js, line 22
Members
-
firstgid :integer
-
The Tiled firstgid value. This is the starting index of the first image index this Image Collection contains.
- Source - tilemap/ImageCollection.js, line 40
-
<readonly> imageHeight :integer
-
The height of the tallest image (in pixels).
- Source - tilemap/ImageCollection.js, line 54
-
<readonly> imageMargin
-
The margin around the images in the collection (in pixels). Use
setSpacing
to change.- Source - tilemap/ImageCollection.js, line 63
Properties:
Name Type Description imageMarge
integer -
<readonly> images :array
-
The cached images that are a part of this collection.
- Source - tilemap/ImageCollection.js, line 85
-
<readonly> imageSpacing :integer
-
The spacing between each image in the collection (in pixels). Use
setSpacing
to change.- Source - tilemap/ImageCollection.js, line 71
-
<readonly> imageWidth :integer
-
The width of the widest image (in pixels).
- Source - tilemap/ImageCollection.js, line 47
-
name :string
-
The name of the Image Collection.
- Source - tilemap/ImageCollection.js, line 33
-
properties :object
-
Image Collection-specific properties that are typically defined in the Tiled editor.
- Source - tilemap/ImageCollection.js, line 77
-
<readonly> total :integer
-
The total number of images in the image collection.
- Source - tilemap/ImageCollection.js, line 93
Methods
-
addImage(gid, image)
-
Add an image to this Image Collection.
Parameters:
Name Type Description gid
integer 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.
- Source - tilemap/ImageCollection.js, line 114
-
containsImageIndex(imageIndex) → {boolean}
-
Returns true if and only if this image collection contains the given image index.
Parameters:
Name Type Description imageIndex
integer The image index to search for.
Returns:
boolean -True if this Image Collection contains the given index.
- Source - tilemap/ImageCollection.js, line 98