public class TiledTile extends Object implements TiledCustomizable
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.
|
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.
|
Map<String,Object> |
getNonDefaultProperties()
Returns an unmodifiable Map view of this tile's custom properties that
were specified by the tile itself, rather than as defaults via its object
type.
|
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.
|
Map<String,Object> |
getProperties()
Returns an unmodifiable Map view of this entity's custom properties.
|
Object |
getProperty(String name)
Returns the value of this entity'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.
|
String |
getType()
Returns this tile's object type, or null if it was not specified.
|
TiledObjectType |
getTypeInfo()
Returns the object type information that determined the default values of
this tile's custom properties, or null if no such information was used.
|
public final TiledTileset getTileset()
public final int getID()
public final int getTilesetX()
public final int getTilesetY()
public final TiledImage getImage()
public final String getType()
public final TiledObjectType getTypeInfo()
public final TiledTerrainType getTopLeftTerrainType()
public final TiledTerrainType getTopRightTerrainType()
public final TiledTerrainType getBottomLeftTerrainType()
public final TiledTerrainType getBottomRightTerrainType()
public final float getProbability()
public final List<TiledObject> getCollisionObjects()
public final int getNumAnimationFrames()
public final TiledTile getAnimationFrame(int index)
index
- The index of the frame to be returnedUnsupportedOperationException
- if this tile is not animatedIndexOutOfBoundsException
- if the index is out of rangepublic final int getAnimationFrameDuration(int index)
index
- The index of the frame duration to be returnedUnsupportedOperationException
- if this tile is not animatedIndexOutOfBoundsException
- if the index is out of rangepublic final Map<String,Object> getProperties()
TiledCustomizable
java.awt.Color
for a color, TiledFile for a file, and TiledObject for an object (unless
the object property is unset, in which case the value is null).getProperties
in interface TiledCustomizable
public final Object getProperty(String name)
TiledCustomizable
java.awt.Color
for a color, TiledFile for a file, and
TiledObject for an object (unless the object property is unset, in which
case the value is null).getProperty
in interface TiledCustomizable
name
- The name of the property whose value is to be returnedpublic final Map<String,Object> getNonDefaultProperties()
Copyright © 2020. All rights reserved.