new ImageCollection(name, firstgid [, width] [, height] [, margin] [, spacing] [, properties])
Parameters:
Name | Type | Argument | 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. |
- Since: 3.0.0
- Source: src/tilemaps/ImageCollection.js (Line 9)
Members
-
firstgid :number
-
The Tiled firstgid value. This is the starting index of the first image index this Image Collection contains.
Type:
- number
- Since: 3.0.0
- Source: src/tilemaps/ImageCollection.js (Line 48)
-
<readonly> imageHeight :number
-
The height of the tallest image (in pixels).
Type:
- number
- Since: 3.0.0
- Source: src/tilemaps/ImageCollection.js (Line 68)
-
<readonly> imageMarge :number
-
The margin around the images in the collection (in pixels). Use
setSpacing
to change.Type:
- number
- Since: 3.0.0
- Source: src/tilemaps/ImageCollection.js (Line 78)
-
<readonly> images :array
-
The cached images that are a part of this collection.
Type:
- array
- Since: 3.0.0
- Source: src/tilemaps/ImageCollection.js (Line 109)
-
<readonly> imageSpacing :number
-
The spacing between each image in the collection (in pixels). Use
setSpacing
to change.Type:
- number
- Since: 3.0.0
- Source: src/tilemaps/ImageCollection.js (Line 89)
-
<readonly> imageWidth :number
-
The width of the widest image (in pixels).
Type:
- number
- Since: 3.0.0
- Source: src/tilemaps/ImageCollection.js (Line 58)
-
name :string
-
The name of the Image Collection.
Type:
- string
- Since: 3.0.0
- Source: src/tilemaps/ImageCollection.js (Line 39)
-
properties :object
-
Image Collection-specific properties that are typically defined in the Tiled editor.
Type:
- object
- Since: 3.0.0
- Source: src/tilemaps/ImageCollection.js (Line 100)
-
<readonly> total :number
-
The total number of images in the image collection.
Type:
- number
- Since: 3.0.0
- Source: src/tilemaps/ImageCollection.js (Line 119)
Methods
-
addImage(gid, image)
-
Add an image to this Image Collection.
Parameters:
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.
- Since: 3.0.0
- Source: src/tilemaps/ImageCollection.js (Line 145)
Returns:
This ImageCollection object.
-
containsImageIndex(imageIndex)
-
Returns true if and only if this image collection contains the given image index.
Parameters:
Name Type Description imageIndex
number The image index to search for.
- Since: 3.0.0
- Source: src/tilemaps/ImageCollection.js (Line 130)
Returns:
True if this Image Collection contains the given index.
- Type
- boolean