public class ObjectTile extends Tile
An object tile is generally positioned based on its origin rather than the upper left of
its image. Generally this origin is in the bottom center of the object image, but can be
configured to be anywhere that the natural center point of "contact" is for the object. Note
that this does not automatically adjust the semantics of Tile.paint(java.awt.Graphics2D, int, int), it is just
expected that the caller will account for the object tile's origin when painting, if
appropriate.
An object tile has dimensions (in tile units) that represent its footprint or "shadow".
| Constructor and Description |
|---|
ObjectTile() |
| Modifier and Type | Method and Description |
|---|---|
int |
getBaseHeight()
Returns the object footprint height in tile units.
|
int |
getBaseWidth()
Returns the object footprint width in tile units.
|
String[] |
getConstraints()
Returns the list of constraints associated with this object, or
null if the
object has no constraints. |
int |
getOriginX()
Returns the x offset into the tile image of the origin (which will be aligned with the
bottom center of the origin tile) or
Integer.MIN_VALUE if the origin is not
explicitly specified and should be computed from the image size and tile footprint. |
int |
getOriginY()
Returns the y offset into the tile image of the origin (which will be aligned with the
bottom center of the origin tile) or
Integer.MIN_VALUE if the origin is not
explicitly specified and should be computed from the image size and tile footprint. |
int |
getPriority()
Returns this object tile's default render priority.
|
int |
getSpotOrient()
Returns the orientation of the "spot" associated with this object.
|
int |
getSpotX()
Returns the x-coordinate of the "spot" associated with this object.
|
int |
getSpotY()
Returns the x-coordinate of the "spot" associated with this object.
|
boolean |
hasConstraint(String constraint)
Checks whether this object has the given constraint.
|
boolean |
hasSpot()
Returns true if this object has a spot.
|
void |
setConstraints(String[] constraints)
Configures this object's constraints.
|
void |
setSpot(int x,
int y,
byte orient)
Configures the "spot" associated with this object.
|
void |
toString(StringBuilder buf)
This should be overridden by derived classes (which should be sure
to call
super.toString()) to append the derived class
specific tile information to the string buffer. |
public int getBaseWidth()
public int getBaseHeight()
public int getOriginX()
Integer.MIN_VALUE if the origin is not
explicitly specified and should be computed from the image size and tile footprint.public int getOriginY()
Integer.MIN_VALUE if the origin is not
explicitly specified and should be computed from the image size and tile footprint.public int getPriority()
public void setSpot(int x,
int y,
byte orient)
public boolean hasSpot()
public int getSpotX()
public int getSpotY()
public int getSpotOrient()
public String[] getConstraints()
null if the
object has no constraints.public boolean hasConstraint(String constraint)
public void setConstraints(String[] constraints)
public void toString(StringBuilder buf)
Tilesuper.toString()) to append the derived class
specific tile information to the string buffer.Copyright © 2015. All rights reserved.