public class TiledTile
extends java.lang.Object
A TiledTile represents one of the tiles in a tileset. It corresponds to a <tile> tag inside a <tileset> tag in a Tiled XML file, or to a tile implicitly declared by the attributes of a <tileset> tag.
Modifier and Type | Method and Description |
---|---|
TiledTile |
getAnimationFrame(int index)
Returns the tile displayed in this tile's animation frame at the
specified index (0 to getNumAnimationFrames() - 1 inclusive).
|
int |
getAnimationFrameDuration(int index)
Returns the duration in milliseconds of this tile's animation frame at
the specified index (0 to getNumAnimationFrames() - 1 inclusive).
|
TiledTerrainType |
getBottomLeftTerrainType()
Returns the terrain type of this tile's bottom left corner, or null if
the corner has no terrain type.
|
TiledTerrainType |
getBottomRightTerrainType()
Returns the terrain type of this tile's bottom right corner, or null if
the corner has no terrain type.
|
java.util.List<TiledObject> |
getCollisionObjects()
Returns an unmodifiable List view of the objects that specify this tile's
collision properties.
|
int |
getID()
Returns this tile's local ID within its tileset.
|
TiledImage |
getImage()
Returns this tile's image, if it is part of an image collection tileset,
or null if it is not.
|
int |
getNumAnimationFrames()
Returns the number of frames in this tile's animation, or 0 if this tile
is not animated.
|
float |
getProbability()
Returns this tile's probability of being chosen over competing tiles by
the terrain tool, or -1 if it was not specified.
|
java.util.Map<java.lang.String,java.lang.Object> |
getProperties()
Returns an unmodifiable Map view of this tile's custom properties.
|
java.lang.Object |
getProperty(java.lang.String name)
Returns the value of this tile's custom property with the specified name,
or null if no such property was specified.
|
TiledTileset |
getTileset()
Returns the tileset to which this tile belongs.
|
int |
getTilesetX()
Returns this tile's x-coordinate within its tileset, if it is a
single-image tileset, or -1 if it is an image collection tileset.
|
int |
getTilesetY()
Returns this tile's y-coordinate within its tileset, if it is a
single-image tileset, or -1 if it is an image collection tileset.
|
TiledTerrainType |
getTopLeftTerrainType()
Returns the terrain type of this tile's top left corner, or null if the
corner has no terrain type.
|
TiledTerrainType |
getTopRightTerrainType()
Returns the terrain type of this tile's top right corner, or null if the
corner has no terrain type.
|
java.lang.String |
getType()
Returns this tile's object type, or null if it was not specified.
|
public final TiledTileset getTileset()
public final int getID()
public final int getTilesetX()
public final int getTilesetY()
public final TiledImage getImage()
public final java.lang.String getType()
public final TiledTerrainType getTopLeftTerrainType()
public final TiledTerrainType getTopRightTerrainType()
public final TiledTerrainType getBottomLeftTerrainType()
public final TiledTerrainType getBottomRightTerrainType()
public final float getProbability()
public final java.util.List<TiledObject> getCollisionObjects()
public final int getNumAnimationFrames()
public final TiledTile getAnimationFrame(int index)
index
- The index of the frame to be returnedjava.lang.UnsupportedOperationException
- if this tile is not animatedjava.lang.IndexOutOfBoundsException
- if the index is out of rangepublic final int getAnimationFrameDuration(int index)
index
- The index of the frame duration to be returnedjava.lang.UnsupportedOperationException
- if this tile is not animatedjava.lang.IndexOutOfBoundsException
- if the index is out of rangepublic final java.util.Map<java.lang.String,java.lang.Object> getProperties()
java.awt.Color
for a color, java.io.File
for a file, and TiledObject for an
object (unless the object property is unset, in which case the value is
null).public final java.lang.Object getProperty(java.lang.String name)
java.awt.Color
for a color, java.io.File
for a
file, and TiledObject for an object (unless the object property is unset,
in which case the value is null).name
- The name of the property whose value is to be returned