Class MapObject

java.lang.Object
studio.magemonkey.codex.mccore.gui.MapObject

public class MapObject extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    protected MapImage
     
    protected boolean
     
    protected int
     
    protected int
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    MapObject(MapImage img, int x, int y)
    Initializes the MapObject at the given coordinates
    MapObject(MapImage img, int x, int y, boolean visible)
    Initializes the MapObject at the given coordinates and sets the visibility.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Cleans the object, removing any tracked changes.
    int[]
    Retrieves the bounds of the changes.
    int
     
    int
     
    int
     
    int
     
    void
    Hides the object, no longer drawing it each update
    boolean
    Checks whether or not the object requires an update.
    void
    move(int x, int y)
    Moves the object relative to its current location
    void
    moveTo(int x, int y)
    Moves the object to the given position
    void
    setVisible(boolean visible)
    Sets the visibility of the object using a boolean value
    void
    Shows the object, enabling drawing it to the map

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Field Details

    • img

      protected MapImage img
    • x

      protected int x
    • y

      protected int y
    • visible

      protected boolean visible
  • Constructor Details

    • MapObject

      public MapObject(MapImage img, int x, int y)
      Initializes the MapObject at the given coordinates
      Parameters:
      img - image to draw
      x - initial X position
      y - initial Y position
    • MapObject

      public MapObject(MapImage img, int x, int y, boolean visible)
      Initializes the MapObject at the given coordinates and sets the visibility.
      Parameters:
      img - image to draw
      x - initial X position
      y - initial Y position
      visible - whether or not it can be seen initially
  • Method Details

    • getX

      public int getX()
    • getY

      public int getY()
    • getWidth

      public int getWidth()
    • getHeight

      public int getHeight()
    • hide

      public void hide()
      Hides the object, no longer drawing it each update
    • show

      public void show()
      Shows the object, enabling drawing it to the map
    • setVisible

      public void setVisible(boolean visible)
      Sets the visibility of the object using a boolean value
      Parameters:
      visible - visibility of the object
    • move

      public void move(int x, int y)
      Moves the object relative to its current location
      Parameters:
      x - horizontal change
      y - vertical change
    • moveTo

      public void moveTo(int x, int y)
      Moves the object to the given position
      Parameters:
      x - horizontal position
      y - vertical position
    • isDirty

      public boolean isDirty()
      Checks whether or not the object requires an update. This shouldn't needed to be called outside the API. Don't use this unless you have a good reason.
      Returns:
      true if required, false otherwise
    • getFlagBounds

      public int[] getFlagBounds()
      Retrieves the bounds of the changes. This shouldn't needed to be called outside the API. Don't use this unless you have a good reason.
      Returns:
      bounds of changes to mark for the packet
    • clean

      public void clean()
      Cleans the object, removing any tracked changes. This should only be called by the API. Do not call this yourself