Interface IMapObject

All Superinterfaces:
Comparable<Resource>, ICustomPropertyProvider, Resource
All Known Implementing Classes:
Blueprint, MapObject

public interface IMapObject extends 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 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 null if this object does not reference a tile
    • getBoundingBox

      Rectangle2D getBoundingBox()
      Gets the hit box.
      Returns:
      the hit box
    • getId

      int getId()
      Gets the id.
      Returns:
      the id
    • getLocation

      Point2D getLocation()
      Gets the location.
      Returns:
      the location
    • getType

      String getType()
      Gets the user-defined type string of this map object.
      Returns:
      the type string
    • getPolyline

      IPolyShape getPolyline()
      Gets the polyline shape of this map object, if any.
      Returns:
      the polyline, or null if this object is not a polyline
    • getPolygon

      IPolyShape getPolygon()
      Gets the polygon shape of this map object, if any.
      Returns:
      the polygon, or null if this object is not a polygon
    • getEllipse

      Ellipse2D getEllipse()
      Gets the ellipse shape of this map object, if any.
      Returns:
      the ellipse, or null if 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 null if this is not a text object
    • getLayer

      IMapObjectLayer getLayer()
      Gets the layer that contains this map object.
      Returns:
      the owning layer
    • 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

      void setType(String type)
      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

      void setLocation(Point2D location)
      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 coordinate
      y - 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:
      true if this object is a polyline
    • isPolygon

      boolean isPolygon()
      Returns whether this map object is a polygon.
      Returns:
      true if this object is a polygon
    • isPoint

      boolean isPoint()
      Returns whether this map object is a single point.
      Returns:
      true if this object is a point
    • isEllipse

      boolean isEllipse()
      Returns whether this map object is an ellipse.
      Returns:
      true if this object is an ellipse
    • setPolyline

      void setPolyline(IPolyShape polyline)
      Sets the polyline shape of this map object.
      Parameters:
      polyline - the polyline shape to set
    • setPolygon

      void setPolygon(IPolyShape polygon)
      Sets the polygon shape of this map object.
      Parameters:
      polygon - the polygon shape to set