public class TiledObject extends Object implements TiledCustomizable
A TiledObject represents a Tiled object in an object layer, or as part of the specification of a tile's collision properties. It corresponds to an <object> tag inside an <objectgroup> tag in a Tiled XML file.
Modifier and Type | Class and Description |
---|---|
static class |
TiledObject.Shape
Represents a shape that a Tiled object can take, such as an ellipse or
polygon.
|
Modifier and Type | Method and Description |
---|---|
float |
getHeight()
Returns this object's height in pixels (0 by default).
|
String |
getName()
Returns this object's name (the empty string by default).
|
Map<String,Object> |
getNonDefaultProperties()
Returns an unmodifiable Map view of this object's custom properties that
were specified by the object itself, rather than as defaults via its
template, tile, or object type.
|
List<Point2D> |
getPoints()
Returns an unmodifiable List view of this sequence of vertex (x, y)
coordinates of this object, if it is a polygon or polyline.
|
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.
|
float |
getRotation()
Returns the rotation of this object in clockwise degrees (0 by default).
|
TiledObject.Shape |
getShape()
Returns this object's shape (
TiledObject.Shape.RECTANGLE by
default). |
TiledObjectTemplate |
getTemplate()
Returns the template from which this object inherits its default
properties, or null if no template was specified.
|
TiledText |
getText()
Returns the text of this object, if it is a text object.
|
TiledTile |
getTile()
Returns the tile that represents this object, if it is a tile object.
|
boolean |
getTileDFlip()
Returns whether the tile that represents this object is flipped
diagonally, if this object is a tile object.
|
boolean |
getTileXFlip()
Returns whether the tile that represents this object is flipped
horizontally, if this object is a tile object.
|
boolean |
getTileYFlip()
Returns whether the tile that represents this object is flipped
vertically, if this object is a tile object.
|
String |
getType()
Returns this object's type (the empty string by default).
|
TiledObjectType |
getTypeInfo()
Returns the object type information that determined the default values of
this object's custom properties, or null if no such information was used.
|
boolean |
getVisible()
Returns whether this object is marked as visible (true by default).
|
float |
getWidth()
Returns this object's width in pixels (0 by default).
|
float |
getX()
Returns this object's x-coordinate in pixels.
|
float |
getY()
Returns this object's y-coordinate in pixels.
|
public final String getName()
public final String getType()
public final TiledObjectType getTypeInfo()
public final float getX()
public final float getY()
public final float getWidth()
public final float getHeight()
public final float getRotation()
public final TiledTile getTile()
public final boolean getTileXFlip()
public final boolean getTileYFlip()
public final boolean getTileDFlip()
public final boolean getVisible()
public final TiledObject.Shape getShape()
TiledObject.Shape.RECTANGLE
by
default).public final List<Point2D> getPoints()
public final TiledText getText()
public 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()
public final TiledObjectTemplate getTemplate()
Copyright © 2020. All rights reserved.