Class MapObject
java.lang.Object
de.gurkenlabs.litiengine.environment.tilemap.xml.CustomPropertyProvider
de.gurkenlabs.litiengine.environment.tilemap.xml.MapObject
- All Implemented Interfaces:
ICustomPropertyProvider, IMapObject, Resource, Comparable<Resource>
- Direct Known Subclasses:
Blueprint
-
Constructor Summary
ConstructorsConstructorDescriptionInstantiates a newMapObjectinstance.Instantiates a newMapObjectinstance by copying the specified original instance.Instantiates a newMapObjectinstance by copying the specified original instance.Instantiates a newMapObjectinstance by copying the specified original instance.Instantiates a newMapObjectinstance. -
Method Summary
Modifier and TypeMethodDescriptionGets the hit box.static Rectangle2DgetBounds(IMapObject... objects) static Rectangle2DgetBounds(Iterable<IMapObject> objects) Gets the ellipse shape of this map object, if any.intGets the grid id.floatGets the height of this map object.intgetId()Gets the id.getLayer()Gets the layer that contains this map object.Gets the location.getName()Gets the name of the resource.Gets the polygon shape of this map object, if any.Gets the polyline shape of this map object, if any.getText()Gets the text content of this map object, if it represents a text object.getTile()Gets the tileset entry referenced by this map object's grid id, if any.getType()Gets the type.floatgetWidth()Gets the width of this map object.floatgetX()Gets the x coordinate of this map object.floatgetY()Gets the y coordinate of this map object.booleanReturns whether this map object is an ellipse.booleanisPoint()Returns whether this map object is a single point.booleanReturns whether this map object is a polygon.booleanReturns whether this map object is a polyline.voidsetGridId(int gid) Sets the grid id, i.e.voidsetHeight(float height) Sets the height of this map object.voidsetId(int id) Sets the unique id of this map object.protected voidsetLayer(MapObjectLayer layer) voidsetLocation(float x, float y) Sets the location of this map object.voidsetLocation(Point2D location) Sets the location of this map object.voidSets the name of the resource.voidsetPolygon(IPolyShape polygon) Sets the polygon shape of this map object.voidsetPolyline(IPolyShape polyline) Sets the polyline shape of this map object.voidSets the user-defined type string of this map object.voidsetWidth(float width) Sets the width of this map object.voidsetX(float x) Sets the x coordinate of this map object.voidsetY(float y) Sets the y coordinate of this map object.toString()Methods inherited from class CustomPropertyProvider
getBoolValue, getBoolValue, getByteValue, getByteValue, getCharValue, getCharValue, getColorValue, getColorValue, getCommaSeparatedStringValues, getDoubleValue, getDoubleValue, getEnumValue, getEnumValue, getFileValue, getFileValue, getFloatValue, getFloatValue, getIntValue, getIntValue, getLongValue, getLongValue, getMapObjectId, getProperties, getProperty, getShortValue, getShortValue, getStringValue, getStringValue, hasCustomProperty, removeProperty, setProperties, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValueMethods inherited from class Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface ICustomPropertyProvider
getBoolValue, getBoolValue, getByteValue, getByteValue, getCharValue, getCharValue, getColorValue, getColorValue, getCommaSeparatedStringValues, getDoubleValue, getDoubleValue, getEnumValue, getEnumValue, getFileValue, getFileValue, getFloatValue, getFloatValue, getIntValue, getIntValue, getLongValue, getLongValue, getMapObjectId, getProperties, getProperty, getShortValue, getShortValue, getStringValue, getStringValue, hasCustomProperty, removeProperty, setProperties, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue, setValue
-
Constructor Details
-
MapObject
public MapObject()Instantiates a newMapObjectinstance. -
MapObject
Instantiates a newMapObjectinstance.- Parameters:
type- The type of this map object.
-
MapObject
Instantiates a new
MapObjectinstance by copying the specified original instance.This variant of the constructor will assign an entirely new ID to the newly created MapObject.
- Parameters:
original- the MapObject we want to copy
-
MapObject
Instantiates a new
MapObjectinstance by copying the specified original instance.This variant of the constructor lets you decide if the copy instance will get the same ID as the old MapObject or get a new ID.
- Parameters:
original- the MapObject we want to copykeepID- decide if the new instance will adopt the old MapObject's ID or get a new, unique one.
-
MapObject
Instantiates a newMapObjectinstance by copying the specified original instance.- Parameters:
original- the MapObject we want to copyid- The id of this instance.
-
-
Method Details
-
getBounds
-
getBounds
-
getGridId
public int getGridId()Description copied from interface:IMapObjectGets the grid id.- Specified by:
getGridIdin interfaceIMapObject- Returns:
- the grid id
-
getTile
Description copied from interface:IMapObjectGets the tileset entry referenced by this map object's grid id, if any.- Specified by:
getTilein interfaceIMapObject- Returns:
- the referenced tileset entry, or
nullif this object does not reference a tile
-
getBoundingBox
Description copied from interface:IMapObjectGets the hit box.- Specified by:
getBoundingBoxin interfaceIMapObject- Returns:
- the hit box
-
getId
public int getId()Description copied from interface:IMapObjectGets the id.- Specified by:
getIdin interfaceIMapObject- Returns:
- the id
-
getLocation
Description copied from interface:IMapObjectGets the location.- Specified by:
getLocationin interfaceIMapObject- Returns:
- the location
-
getName
-
getType
Gets the type.- Specified by:
getTypein interfaceIMapObject- Returns:
- the type
-
getPolyline
Description copied from interface:IMapObjectGets the polyline shape of this map object, if any.- Specified by:
getPolylinein interfaceIMapObject- Returns:
- the polyline, or
nullif this object is not a polyline
-
getPolygon
Description copied from interface:IMapObjectGets the polygon shape of this map object, if any.- Specified by:
getPolygonin interfaceIMapObject- Returns:
- the polygon, or
nullif this object is not a polygon
-
getEllipse
Description copied from interface:IMapObjectGets the ellipse shape of this map object, if any.- Specified by:
getEllipsein interfaceIMapObject- Returns:
- the ellipse, or
nullif this object is not an ellipse
-
getText
Description copied from interface:IMapObjectGets the text content of this map object, if it represents a text object.- Specified by:
getTextin interfaceIMapObject- Returns:
- the text content, or
nullif this is not a text object
-
setGridId
public void setGridId(int gid) Description copied from interface:IMapObjectSets the grid id, i.e. the global tile id this object references.- Specified by:
setGridIdin interfaceIMapObject- Parameters:
gid- the grid id to set
-
setHeight
public void setHeight(float height) Description copied from interface:IMapObjectSets the height of this map object.- Specified by:
setHeightin interfaceIMapObject- Parameters:
height- the height to set
-
setId
public void setId(int id) Description copied from interface:IMapObjectSets the unique id of this map object.- Specified by:
setIdin interfaceIMapObject- Parameters:
id- the id to set
-
setName
-
setType
Description copied from interface:IMapObjectSets the user-defined type string of this map object.- Specified by:
setTypein interfaceIMapObject- Parameters:
type- the type to set
-
setWidth
public void setWidth(float width) Description copied from interface:IMapObjectSets the width of this map object.- Specified by:
setWidthin interfaceIMapObject- Parameters:
width- the width to set
-
setX
public void setX(float x) Description copied from interface:IMapObjectSets the x coordinate of this map object.- Specified by:
setXin interfaceIMapObject- Parameters:
x- the x coordinate
-
setY
public void setY(float y) Description copied from interface:IMapObjectSets the y coordinate of this map object.- Specified by:
setYin interfaceIMapObject- Parameters:
y- the y coordinate
-
setLocation
Description copied from interface:IMapObjectSets the location of this map object.- Specified by:
setLocationin interfaceIMapObject- Parameters:
location- the new location
-
setLocation
public void setLocation(float x, float y) Description copied from interface:IMapObjectSets the location of this map object.- Specified by:
setLocationin interfaceIMapObject- Parameters:
x- the x coordinatey- the y coordinate
-
toString
-
getX
public float getX()Description copied from interface:IMapObjectGets the x coordinate of this map object.- Specified by:
getXin interfaceIMapObject- Returns:
- the x coordinate
-
getY
public float getY()Description copied from interface:IMapObjectGets the y coordinate of this map object.- Specified by:
getYin interfaceIMapObject- Returns:
- the y coordinate
-
setPolyline
Description copied from interface:IMapObjectSets the polyline shape of this map object.- Specified by:
setPolylinein interfaceIMapObject- Parameters:
polyline- the polyline shape to set
-
setPolygon
Description copied from interface:IMapObjectSets the polygon shape of this map object.- Specified by:
setPolygonin interfaceIMapObject- Parameters:
polygon- the polygon shape to set
-
getWidth
public float getWidth()Description copied from interface:IMapObjectGets the width of this map object.- Specified by:
getWidthin interfaceIMapObject- Returns:
- the width
-
getHeight
public float getHeight()Description copied from interface:IMapObjectGets the height of this map object.- Specified by:
getHeightin interfaceIMapObject- Returns:
- the height
-
getLayer
Description copied from interface:IMapObjectGets the layer that contains this map object.- Specified by:
getLayerin interfaceIMapObject- Returns:
- the owning layer
-
isPolyline
public boolean isPolyline()Description copied from interface:IMapObjectReturns whether this map object is a polyline.- Specified by:
isPolylinein interfaceIMapObject- Returns:
trueif this object is a polyline
-
isPolygon
public boolean isPolygon()Description copied from interface:IMapObjectReturns whether this map object is a polygon.- Specified by:
isPolygonin interfaceIMapObject- Returns:
trueif this object is a polygon
-
isPoint
public boolean isPoint()Description copied from interface:IMapObjectReturns whether this map object is a single point.- Specified by:
isPointin interfaceIMapObject- Returns:
trueif this object is a point
-
isEllipse
public boolean isEllipse()Description copied from interface:IMapObjectReturns whether this map object is an ellipse.- Specified by:
isEllipsein interfaceIMapObject- Returns:
trueif this object is an ellipse
-
setLayer
-