Class MapObject
java.lang.Object
studio.magemonkey.codex.mccore.gui.MapObject
-
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidclean()Cleans the object, removing any tracked changes.int[]Retrieves the bounds of the changes.intintgetWidth()intgetX()intgetY()voidhide()Hides the object, no longer drawing it each updatebooleanisDirty()Checks whether or not the object requires an update.voidmove(int x, int y) Moves the object relative to its current locationvoidmoveTo(int x, int y) Moves the object to the given positionvoidsetVisible(boolean visible) Sets the visibility of the object using a boolean valuevoidshow()Shows the object, enabling drawing it to the map
-
Field Details
-
img
-
x
protected int x -
y
protected int y -
visible
protected boolean visible
-
-
Constructor Details
-
MapObject
Initializes the MapObject at the given coordinates- Parameters:
img- image to drawx- initial X positiony- initial Y position
-
MapObject
Initializes the MapObject at the given coordinates and sets the visibility.- Parameters:
img- image to drawx- initial X positiony- initial Y positionvisible- 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 changey- vertical change
-
moveTo
public void moveTo(int x, int y) Moves the object to the given position- Parameters:
x- horizontal positiony- 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
-