Interface IMapObject
- All Superinterfaces:
Comparable<Resource>, ICustomPropertyProvider, Resource
This interface represents an instance on a map that can define various things for an engine. e.g. it can be used to
define static collision boxes or other special regions on the map.
-
Method Summary
Modifier and TypeMethodDescriptionGets the hit box.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.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 user-defined type string of this map object.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.voidsetLocation(float x, float y) Sets the location of this map object.voidsetLocation(Point2D location) Sets the location of this map object.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.Methods 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
-
Method Details
-
getGridId
int getGridId()Gets the grid id.- Returns:
- the grid id
-
getTile
ITilesetEntry getTile()Gets the tileset entry referenced by this map object's grid id, if any.- Returns:
- the referenced tileset entry, or
nullif this object does not reference a tile
-
getBoundingBox
-
getId
int getId()Gets the id.- Returns:
- the id
-
getLocation
-
getType
-
getPolyline
IPolyShape getPolyline()Gets the polyline shape of this map object, if any.- Returns:
- the polyline, or
nullif this object is not a polyline
-
getPolygon
IPolyShape getPolygon()Gets the polygon shape of this map object, if any.- Returns:
- the polygon, or
nullif this object is not a polygon
-
getEllipse
Ellipse2D getEllipse()Gets the ellipse shape of this map object, if any.- Returns:
- the ellipse, or
nullif this object is not an ellipse
-
getText
IMapObjectText getText()Gets the text content of this map object, if it represents a text object.- Returns:
- the text content, or
nullif this is not a text object
-
getLayer
-
setGridId
void setGridId(int gid) Sets the grid id, i.e. the global tile id this object references.- Parameters:
gid- the grid id to set
-
setId
void setId(int id) Sets the unique id of this map object.- Parameters:
id- the id to set
-
setType
Sets the user-defined type string of this map object.- Parameters:
type- the type to set
-
setX
void setX(float x) Sets the x coordinate of this map object.- Parameters:
x- the x coordinate
-
setY
void setY(float y) Sets the y coordinate of this map object.- Parameters:
y- the y coordinate
-
setLocation
Sets the location of this map object.- Parameters:
location- the new location
-
setLocation
void setLocation(float x, float y) Sets the location of this map object.- Parameters:
x- the x coordinatey- the y coordinate
-
setWidth
void setWidth(float width) Sets the width of this map object.- Parameters:
width- the width to set
-
setHeight
void setHeight(float height) Sets the height of this map object.- Parameters:
height- the height to set
-
getX
float getX()Gets the x coordinate of this map object.- Returns:
- the x coordinate
-
getY
float getY()Gets the y coordinate of this map object.- Returns:
- the y coordinate
-
getWidth
float getWidth()Gets the width of this map object.- Returns:
- the width
-
getHeight
float getHeight()Gets the height of this map object.- Returns:
- the height
-
isPolyline
boolean isPolyline()Returns whether this map object is a polyline.- Returns:
trueif this object is a polyline
-
isPolygon
boolean isPolygon()Returns whether this map object is a polygon.- Returns:
trueif this object is a polygon
-
isPoint
boolean isPoint()Returns whether this map object is a single point.- Returns:
trueif this object is a point
-
isEllipse
boolean isEllipse()Returns whether this map object is an ellipse.- Returns:
trueif this object is an ellipse
-
setPolyline
Sets the polyline shape of this map object.- Parameters:
polyline- the polyline shape to set
-
setPolygon
Sets the polygon shape of this map object.- Parameters:
polygon- the polygon shape to set
-