public abstract class SpaceObject
extends java.lang.Object
A SpaceObject is a physical object in a SpaceState's space. SpaceObjects may be assigned to one SpaceState each in much the same way that SubThinkers are assigned to Thinkers. A SpaceObject's assigned SpaceState will keep track of time for it and its AnimationInstances. A SpaceObject's time factor represents the average number of discrete time units the SpaceObject will experience every frame while assigned to an active SpaceState. If its time factor is negative, as it is by default, a SpaceObject will use its assigned SpaceState's time factor instead. If a SpaceObject is assigned to an inactive SpaceState or none at all, time will not pass for it.
A SpaceObject inherits the position, flipped status, angle of rotation, and rectangular bounding box of a locator Hitbox that is relative to no other Hitbox. A SpaceObject may also have an overlap Hitbox that represents it for purposes of overlapping other SpaceObjects and/or a solid Hitbox that represents it for purposes of surface solidity and MobileObjects colliding with it. The solid Hitbox's rectangular bounding box, rather than its exact shape, is what represents the SpaceObject in Cell2D's standard collision mechanics. A SpaceObject may use a single Hitbox for more than one purpose, but a Hitbox may not be used by multiple SpaceObjects at once. All of a SpaceObject's Hitboxes other than its locator Hitbox have positions, flipped statuses, and angles of rotation that are relative to those of its locator Hitbox.
A SpaceObject has a point called a center that summarizes its location. Its center has an offset that is relative to the SpaceObject's position, flipped status, and angle of rotation. SpaceObjects' centers are the points from which their distances and angles to other SpaceObjects are measured.
A SpaceObject has a Drawable appearance that represents it as seen through a Viewport's camera, as well as two properties that only affect how its appearance is drawn: an alpha (opacity) value that is normalized to be between 0 and 1, and a Filter. By default, these are Sprite.BLANK, 1, and "no Filter", respectively. A SpaceObject's use of its appearance, alpha value, and Filter to represent itself is a result of its default draw() method, which can be overridden. A SpaceObject will only be drawn if its locator Hitbox's rectangular bounding box intersects the Viewport's field of view. A SpaceObject's draw priority (0 by default) determines whether it will be drawn in front of or behind other SpaceObjects that intersect it. SpaceObjects with higher draw priorities are drawn in front of those with lower ones.
An AnimationInstance may be assigned to a SpaceObject with or without an integer ID in the context of that SpaceObject, if the AnimationInstance is not already assigned to a GameState or SpaceObject. Only one AnimationInstance may be assigned to a given SpaceObject with a given ID at once. A SpaceObject will automatically set its assigned AnimationInstances' time factors and add and remove them from SpaceStates as appropriate to match its own time factor and assigned SpaceState.
Constructor and Description |
---|
SpaceObject()
Constructs a SpaceObject with no locator Hitbox.
|
Modifier and Type | Method and Description |
---|---|
AnimationInstance |
addAnimInstance(Animation animation)
Adds a new AnimationInstance of the specified Animation to this
SpaceObject without an ID.
|
boolean |
addAnimInstance(AnimationInstance instance)
Adds the specified AnimationInstance to this SpaceObject without an ID,
if it is not already assigned to a GameState.
|
double |
angleTo(SpaceObject object)
Returns the angle from this SpaceObject's center to the specified
SpaceObject's center.
|
<O extends SpaceObject> |
boundingBoxesMeet(java.lang.Class<O> cls)
Returns all of the SpaceObjects of the specified class in this
SpaceObject's SpaceState whose overlap Hitboxes' rectangular bounding
boxes touch or intersect this SpaceObject's overlap Hitbox's rectangular
bounding box.
|
void |
changeAngle(double angle)
Changes this SpaceObject's angle of rotation by the specified amount.
|
void |
changePosition(CellVector change)
Changes this SpaceObject's position by the specified amount.
|
void |
changePosition(long changeX,
long changeY)
Changes the coordinates of this SpaceObject's position by the specified
amounts.
|
void |
changeX(long changeX)
Changes the x-coordinate of this SpaceObject's position by the specified
amount.
|
void |
changeY(long changeY)
Changes the y-coordinate of this SpaceObject's position by the specified
amount.
|
void |
clearAnimInstances()
Removes from this SpaceObject all AnimationInstances that are currently
assigned to it.
|
long |
distanceTo(SpaceObject object)
Returns the distance from this SpaceObject's center to the specified
SpaceObject's center.
|
void |
draw(Graphics g,
int x,
int y)
Draws this SpaceObject as seen through a Viewport's camera.
|
void |
flipX()
Flips this SpaceObject horizontally, making it flipped if it was not
before and not flipped if it was before.
|
void |
flipY()
Flips this SpaceObject vertically, making it flipped if it was not before
and not flipped if it was before.
|
double |
getAlpha()
Returns this SpaceObject's alpha value.
|
double |
getAngle()
Returns this SpaceObject's angle of rotation.
|
long |
getAngleX()
Returns the x-coordinate of the unit vector that points in the direction
of this SpaceObject's angle of rotation.
|
long |
getAngleY()
Returns the y-coordinate of the unit vector that points in the direction
of this SpaceObject's angle of rotation.
|
Animation |
getAnimation()
Returns the Animation of the AnimationInstance assigned to this
SpaceObject with ID 0, or Animation.BLANK if there is none.
|
Animation |
getAnimation(int id)
Returns the Animation of the AnimationInstance assigned to this
SpaceObject with the specified ID, or Animation.BLANK if there is none.
|
AnimationInstance |
getAnimInstance()
Returns the AnimationInstance that is assigned to this SpaceObject with
ID 0, or AnimationInstance.BLANK if there is none.
|
AnimationInstance |
getAnimInstance(int id)
Returns the AnimationInstance that is assigned to this SpaceObject with
the specified ID, or AnimationInstance.BLANK if there is none.
|
Drawable |
getAppearance()
Returns this SpaceObject's appearance.
|
long |
getBottomEdge()
Returns the y-coordinate of this SpaceObject's absolute bottom boundary.
|
CellVector |
getCenter()
Returns the absolute position of this SpaceObject's center.
|
CellVector |
getCenterOffset()
Returns this SpaceObject's center's offset.
|
long |
getCenterOffsetX()
Returns the x-coordinate of this SpaceObject's center's offset.
|
long |
getCenterOffsetY()
Returns the y-coordinate of this SpaceObject's center's offset.
|
long |
getCenterX()
Returns the absolute x-coordinate of this SpaceObject's center.
|
long |
getCenterY()
Returns the absolute y-coordinate of this SpaceObject's center.
|
int |
getDrawPriority()
Returns this SpaceObject's draw priority.
|
long |
getEffectiveTimeFactor()
Returns this SpaceObject's effective time factor; that is, the average
number of time units it experiences every frame.
|
Filter |
getFilter()
Returns this SpaceObject's Filter, or null if it has none.
|
CellGame |
getGame()
Returns the CellGame of the SpaceState to which this SpaceObject is
assigned, or null if it is not assigned to a SpaceState.
|
SpaceState |
getGameState()
Returns the SpaceState to which this SpaceObject is assigned, or null if
it is not assigned to one.
|
long |
getHeight()
Returns the difference between the y-coordinates of this SpaceObject's
absolute bottom and top boundaries.
|
long |
getLeftEdge()
Returns the x-coordinate of this SpaceObject's absolute left boundary.
|
Hitbox |
getLocatorHitbox()
Returns this SpaceObject's locator Hitbox.
|
SpaceState |
getNewGameState()
Returns the SpaceState to which this SpaceObject is about to be assigned,
but has not yet been due to one or more of the object lists involved
being iterated over.
|
int |
getNumAnimInstances()
Returns the number of AnimationInstances that are assigned to this
SpaceObject, with or without IDs.
|
Hitbox |
getOverlapHitbox()
Returns this SpaceObject's overlap Hitbox, or null if it has none.
|
CellVector |
getPosition()
Returns this SpaceObject's position.
|
long |
getRightEdge()
Returns the x-coordinate of this SpaceObject's absolute right boundary.
|
Hitbox |
getSolidHitbox()
Returns this SpaceObject's solid Hitbox, or null if it has none.
|
long |
getTimeFactor()
Returns this SpaceObject's time factor.
|
long |
getTopEdge()
Returns the y-coordinate of this SpaceObject's absolute top boundary.
|
long |
getWidth()
Returns the difference between the x-coordinates of this SpaceObject's
absolute right and left boundaries.
|
long |
getX()
Returns the x-coordinate of this SpaceObject's position.
|
boolean |
getXFlip()
Returns whether this SpaceObject is horizontally flipped.
|
int |
getXSign()
Returns -1 if this SpaceObject is horizontally flipped and 1 if it is
not.
|
long |
getY()
Returns the y-coordinate of this SpaceObject's position.
|
boolean |
getYFlip()
Returns whether this SpaceObject is vertically flipped.
|
int |
getYSign()
Returns -1 if this SpaceObject is vertically flipped and 1 if it is not.
|
<O extends SpaceObject> |
intersectingSolidObject(java.lang.Class<O> cls)
Returns a solid SpaceObject of the specified class in this SpaceObject's
SpaceState whose solid Hitbox is overlapping it, or null if there is
none.
|
<O extends SpaceObject> |
intersectingSolidObjects(java.lang.Class<O> cls)
Returns all of the solid SpaceObjects of the specified class in this
SpaceObject's SpaceState whose solid Hitboxes are overlapping it.
|
<O extends SpaceObject> |
isIntersectingSolidObject(java.lang.Class<O> cls)
Returns whether this SpaceObject is overlapping the solid Hitbox of a
solid SpaceObject of the specified class in its SpaceState.
|
<O extends SpaceObject> |
isOverlappingObject(java.lang.Class<O> cls)
Returns whether this SpaceObject is overlapping a SpaceObject of the
specified class in its SpaceState.
|
boolean |
isSolid()
Returns whether any of this SpaceObject's surfaces are solid.
|
boolean |
isVisible()
Returns whether any part of this SpaceObject's rectangular bounding box
is visible through any of its SpaceState's Viewports.
|
boolean |
isVisible(Viewport viewport)
Returns whether any part of this SpaceObject's rectangular bounding box
is visible through the specified Viewport.
|
<O extends SpaceObject> |
nearestObject(java.lang.Class<O> cls)
Returns the SpaceObject of the specified class that is nearest to this
SpaceObject in its SpaceState - or null if this SpaceObject has no
SpaceState, or its SpaceState contains no SpaceObject of that class.
|
<O extends SpaceObject> |
nearestObjectWithinCircle(CellVector center,
long radius,
java.lang.Class<O> cls)
Returns the SpaceObject of the specified class within the specified
circular region in this SpaceObject's SpaceState that is nearest to it -
or null if this SpaceObject has no SpaceState, or the region contains no
SpaceObject of that class.
|
<O extends SpaceObject> |
nearestObjectWithinCircle(long centerX,
long centerY,
long radius,
java.lang.Class<O> cls)
Returns the SpaceObject of the specified class within the specified
circular region in this SpaceObject's SpaceState that is nearest to it -
or null if this SpaceObject has no SpaceState, or the region contains no
SpaceObject of that class.
|
<O extends SpaceObject> |
nearestObjectWithinRadius(long radius,
java.lang.Class<O> cls)
Returns the SpaceObject of the specified class within the specified
radius of this SpaceObject in its SpaceState that is nearest to it - or
null if there is none, or if this SpaceObject has no SpaceState.
|
<O extends SpaceObject> |
nearestObjectWithinRectangle(long x1,
long y1,
long x2,
long y2,
java.lang.Class<O> cls)
Returns the SpaceObject of the specified class within the specified
rectangular region in this SpaceObject's SpaceState that is nearest to
it - or null if this SpaceObject has no SpaceState, or the region
contains no SpaceObject of that class.
|
<O extends SpaceObject> |
nearestOverlappingObject(Hitbox hitbox,
java.lang.Class<O> cls)
Returns the SpaceObject of the specified class that overlaps the
specified Hitbox in this SpaceObject's SpaceState that is nearest to it -
or null if this SpaceObject has no SpaceState, or no SpaceObject of that
class is overlapping the Hitbox.
|
<O extends SpaceObject> |
objectIsWithinRadius(long radius,
java.lang.Class<O> cls)
Returns whether there are any SpaceObjects of the specified class within
the specified radius of this SpaceObject in its SpaceState, or false if
this SpaceObject has no SpaceState.
|
<O extends SpaceObject> |
objectsWithinRadius(long radius,
java.lang.Class<O> cls)
Returns all of the SpaceObjects of the specified class within the
specified radius of this SpaceObject in its SpaceState, or an empty list
if this SpaceObject has no SpaceState.
|
<O extends SpaceObject> |
objectWithinRadius(long radius,
java.lang.Class<O> cls)
Returns a SpaceObject of the specified class within the specified radius
of this SpaceObject in its SpaceState - or null if there is none, or if
this SpaceObject has no SpaceState.
|
static boolean |
overlap(SpaceObject object1,
SpaceObject object2)
Returns whether the two specified SpaceObjects overlap.
|
<O extends SpaceObject> |
overlappingObject(java.lang.Class<O> cls)
Returns a SpaceObject of the specified class in this SpaceObject's
SpaceState that is overlapping it, or null if there is none.
|
<O extends SpaceObject> |
overlappingObjects(java.lang.Class<O> cls)
Returns all of the SpaceObjects of the specified class in this
SpaceObject's SpaceState that are overlapping it.
|
boolean |
overlaps(SpaceObject object)
Returns whether this SpaceObject overlaps the specified SpaceObject.
|
boolean |
removeAnimInstance(AnimationInstance instance)
Removes the specified AnimationInstance from this SpaceObject if it is
currently assigned to this GameState without an ID.
|
void |
setAlpha(double alpha)
Sets this SpaceObject's alpha value to the specified value.
|
void |
setAngle(double angle)
Sets this SpaceObject's angle of rotation to the specified value.
|
AnimationInstance |
setAnimation(Animation animation)
Sets this SpaceObject's AnimationInstance with ID 0 to a new
AnimationInstance of the specified Animation, if there is not already an
AnimationInstance of that Animation assigned with ID 0, then sets this
SpaceObject's appearance to its AnimationInstance with ID 0.
|
AnimationInstance |
setAnimation(int id,
Animation animation)
Sets the AnimationInstance that is assigned to this SpaceObject with the
specified ID to a new AnimationInstance of the specified Animation, if
there is not already an AnimationInstance of that Animation assigned
with that ID.
|
boolean |
setAnimInstance(AnimationInstance instance)
Sets both this SpaceObject's appearance and its AnimationInstance with ID
0 to the specified AnimationInstance, if it is not already assigned to a
GameState.
|
boolean |
setAnimInstance(int id,
AnimationInstance instance)
Sets the AnimationInstance that is assigned to this SpaceObject with the
specified ID to the specified AnimationInstance, if it is not already
assigned to a GameState.
|
void |
setAppearance(Drawable appearance)
Sets this SpaceObject's appearance to the specified Drawable.
|
void |
setCenterOffset(CellVector offset)
Sets this SpaceObject's center's offset to the specified value.
|
void |
setCenterOffset(long x,
long y)
Sets the coordinates of this SpaceObject's center's offset to the
specified values.
|
void |
setCenterOffsetX(long x)
Sets the x-coordinate of this SpaceObject's center's offset to the
specified value.
|
void |
setCenterOffsetY(long y)
Sets the y-coordinate of this SpaceObject's center's offset to the
specified value.
|
void |
setDrawPriority(int drawPriority)
Sets this SpaceObject's draw priority to the specified value.
|
void |
setFilter(Filter filter)
Sets this SpaceObject's Filter to the specified Filter, or to "no Filter"
if the specified Filter is null.
|
void |
setGameState(SpaceState state)
Sets the SpaceState to which this SpaceObject is assigned.
|
boolean |
setLocatorHitbox(Hitbox locatorHitbox)
Sets this SpaceObject's locator Hitbox to the specified Hitbox.
|
boolean |
setOverlapHitbox(Hitbox overlapHitbox)
Sets this SpaceObject's overlap Hitbox to the specified Hitbox.
|
void |
setPosition(CellVector position)
Sets this SpaceObject's position to the specified value.
|
void |
setPosition(long x,
long y)
Sets this SpaceObject's position to the specified value.
|
void |
setSolid(boolean solid)
Sets whether this SpaceObject's surfaces in every direction are solid.
|
boolean |
setSolidHitbox(Hitbox solidHitbox)
Sets this SpaceObject's solid Hitbox to the specified Hitbox.
|
void |
setSurfaceSolid(Direction direction,
boolean solid)
Sets whether this SpaceObject's surface in the specified Direction is
solid.
|
void |
setTimeFactor(long timeFactor)
Sets this SpaceObject's time factor to the specified value.
|
void |
setX(long x)
Sets the x-coordinate of this SpaceObject's position to the specified
value.
|
void |
setXFlip(boolean xFlip)
Sets whether this SpaceObject is horizontally flipped.
|
void |
setY(long y)
Sets the y-coordinate of this SpaceObject's position to the specified
value.
|
void |
setYFlip(boolean yFlip)
Sets whether this SpaceObject is vertically flipped.
|
boolean |
surfaceIsSolid(Direction direction)
Returns whether this SpaceObject's surface in the specified Direction is
solid.
|
public SpaceObject()
public final CellGame getGame()
public final SpaceState getGameState()
public final SpaceState getNewGameState()
public final void setGameState(SpaceState state)
state
- The SpaceState to which this SpaceObject should be assignedpublic final long getTimeFactor()
public final long getEffectiveTimeFactor()
public final void setTimeFactor(long timeFactor)
timeFactor
- The new time factorpublic final Hitbox getLocatorHitbox()
public final boolean setLocatorHitbox(Hitbox locatorHitbox)
locatorHitbox
- The new locator Hitboxpublic final CellVector getPosition()
public final long getX()
public final long getY()
public final void setPosition(CellVector position)
position
- The new positionpublic final void setPosition(long x, long y)
x
- The x-coordinate of the new positiony
- The y-coordinate of the new positionpublic final void setX(long x)
x
- The x-coordinate of the new positionpublic final void setY(long y)
y
- The y-coordinate of the new positionpublic final void changePosition(CellVector change)
change
- The amount to change the position bypublic final void changePosition(long changeX, long changeY)
changeX
- The amount to change the position's x-coordinate bychangeY
- The amount to change the position's y-coordinate bypublic final void changeX(long changeX)
changeX
- The amount to change the position's x-coordinate bypublic final void changeY(long changeY)
changeY
- The amount to change the position's y-coordinate bypublic final boolean getXFlip()
public final int getXSign()
public final void setXFlip(boolean xFlip)
xFlip
- Whether this SpaceObject should be horizontally flippedpublic final void flipX()
public final boolean getYFlip()
public final int getYSign()
public final void setYFlip(boolean yFlip)
yFlip
- Whether this SpaceObject should be vertically flippedpublic final void flipY()
public final double getAngle()
public final long getAngleX()
public final long getAngleY()
public final void setAngle(double angle)
angle
- The new angle of rotationpublic final void changeAngle(double angle)
angle
- The amount to change the angle of rotation bypublic final long getLeftEdge()
public final long getRightEdge()
public final long getTopEdge()
public final long getBottomEdge()
public final long getWidth()
public final long getHeight()
public final CellVector getCenterOffset()
public final long getCenterOffsetX()
public final long getCenterOffsetY()
public final void setCenterOffset(CellVector offset)
offset
- This SpaceObject's center's new offsetpublic final void setCenterOffset(long x, long y)
x
- The new x-coordinate of this SpaceObject's center's offsety
- The new y-coordinate of this SpaceObject's center's offsetpublic final void setCenterOffsetX(long x)
x
- The new x-coordinate of this SpaceObject's center's offsetpublic final void setCenterOffsetY(long y)
y
- The new y-coordinate of this SpaceObject's center's offsetpublic final CellVector getCenter()
public final long getCenterX()
public final long getCenterY()
public final long distanceTo(SpaceObject object)
object
- The SpaceObject to return the distance topublic final double angleTo(SpaceObject object)
object
- The SpaceObject to return the angle topublic final <O extends SpaceObject> O nearestObject(java.lang.Class<O> cls)
O
- The subclass of SpaceObject to search forcls
- The Class object that represents the SpaceObject subclasspublic final <O extends SpaceObject> O nearestObjectWithinRectangle(long x1, long y1, long x2, long y2, java.lang.Class<O> cls)
O
- The subclass of SpaceObject to search forx1
- The x-coordinate of the region's left edgey1
- The y-coordinate of the region's top edgex2
- The x-coordinate of the region's right edgey2
- The y-coordinate of the region's bottom edgecls
- The Class object that represents the SpaceObject subclasspublic final <O extends SpaceObject> O nearestObjectWithinCircle(CellVector center, long radius, java.lang.Class<O> cls)
O
- The subclass of SpaceObject to search forcenter
- The region's centerradius
- The region's radiuscls
- The Class object that represents the SpaceObject subclasspublic final <O extends SpaceObject> O nearestObjectWithinCircle(long centerX, long centerY, long radius, java.lang.Class<O> cls)
O
- The subclass of SpaceObject to search forcenterX
- The x-coordinate of the region's centercenterY
- The y-coordinate of the region's centerradius
- The region's radiuscls
- The Class object that represents the SpaceObject subclasspublic final <O extends SpaceObject> O nearestOverlappingObject(Hitbox hitbox, java.lang.Class<O> cls)
O
- The subclass of SpaceObject to search forhitbox
- The Hitbox to check for overlappingcls
- The Class object that represents the SpaceObject subclasspublic final <O extends SpaceObject> boolean objectIsWithinRadius(long radius, java.lang.Class<O> cls)
O
- The subclass of SpaceObject to search forradius
- The radius of this SpaceObject to search withincls
- The Class object that represents the SpaceObject subclasspublic final <O extends SpaceObject> O objectWithinRadius(long radius, java.lang.Class<O> cls)
O
- The subclass of SpaceObject to search forradius
- The radius of this SpaceObject to search withincls
- The Class object that represents the SpaceObject subclasspublic final <O extends SpaceObject> java.util.List<O> objectsWithinRadius(long radius, java.lang.Class<O> cls)
O
- The subclass of SpaceObject to search forradius
- The radius of this SpaceObject to search withincls
- The Class object that represents the SpaceObject subclasspublic final <O extends SpaceObject> O nearestObjectWithinRadius(long radius, java.lang.Class<O> cls)
O
- The subclass of SpaceObject to search forradius
- The radius of this SpaceObject to search withincls
- The Class object that represents the SpaceObject subclasspublic final Hitbox getOverlapHitbox()
public final boolean setOverlapHitbox(Hitbox overlapHitbox)
overlapHitbox
- The new overlap Hitboxpublic final boolean overlaps(SpaceObject object)
object
- The SpaceObject to check for an overlappublic static boolean overlap(SpaceObject object1, SpaceObject object2)
object1
- The first SpaceObjectobject2
- The second SpaceObjectpublic final <O extends SpaceObject> boolean isOverlappingObject(java.lang.Class<O> cls)
O
- The subclass of SpaceObject to search forcls
- The Class object that represents the SpaceObject subclasspublic final <O extends SpaceObject> O overlappingObject(java.lang.Class<O> cls)
O
- The subclass of SpaceObject to search forcls
- The Class object that represents the SpaceObject subclasspublic final <O extends SpaceObject> java.util.List<O> overlappingObjects(java.lang.Class<O> cls)
O
- The subclass of SpaceObject to search forcls
- The Class object that represents the SpaceObject subclasspublic final <O extends SpaceObject> java.util.List<O> boundingBoxesMeet(java.lang.Class<O> cls)
O
- The subclass of SpaceObject to search forcls
- The Class object that represents the SpaceObject subclasspublic final <O extends SpaceObject> boolean isIntersectingSolidObject(java.lang.Class<O> cls)
O
- The subclass of SpaceObject to search forcls
- The Class object that represents the SpaceObject subclasspublic final <O extends SpaceObject> O intersectingSolidObject(java.lang.Class<O> cls)
O
- The subclass of SpaceObject to search forcls
- The Class object that represents the SpaceObject subclasspublic final <O extends SpaceObject> java.util.List<O> intersectingSolidObjects(java.lang.Class<O> cls)
O
- The subclass of SpaceObject to search forcls
- The Class object that represents the SpaceObject subclasspublic final Hitbox getSolidHitbox()
public final boolean setSolidHitbox(Hitbox solidHitbox)
solidHitbox
- The new solid Hitboxpublic final boolean isSolid()
public final boolean surfaceIsSolid(Direction direction)
direction
- The Direction of the surface to examinepublic final void setSurfaceSolid(Direction direction, boolean solid)
direction
- The Direction of the surface whose solidity is to be setsolid
- Whether the surface in the specified Direction should be
solidpublic final void setSolid(boolean solid)
solid
- Whether this SpaceObject's surfaces in every direction
should be solidpublic final int getDrawPriority()
public final void setDrawPriority(int drawPriority)
drawPriority
- The new draw prioritypublic final Drawable getAppearance()
public final void setAppearance(Drawable appearance)
appearance
- The new appearancepublic final int getNumAnimInstances()
public final boolean addAnimInstance(AnimationInstance instance)
instance
- The AnimationInstance to addpublic final AnimationInstance addAnimInstance(Animation animation)
animation
- The Animation to add a new AnimationInstance ofpublic final boolean removeAnimInstance(AnimationInstance instance)
instance
- The AnimationInstance to removepublic final AnimationInstance getAnimInstance(int id)
id
- The ID of the AnimationInstance to be returnedpublic final AnimationInstance getAnimInstance()
public final boolean setAnimInstance(int id, AnimationInstance instance)
id
- The ID with which to assign the specified AnimationInstanceinstance
- The AnimationInstance to add with the specified IDpublic final boolean setAnimInstance(AnimationInstance instance)
instance
- The new appearance and AnimationInstance with ID 0public final Animation getAnimation(int id)
id
- The ID of the AnimationInstance whose Animation is to be
returnedpublic final Animation getAnimation()
public final AnimationInstance setAnimation(int id, Animation animation)
id
- The ID with which to assign the new AnimationInstanceanimation
- The Animation to add a new AnimationInstance ofpublic final AnimationInstance setAnimation(Animation animation)
animation
- The Animation to add a new AnimationInstance ofpublic final void clearAnimInstances()
public final double getAlpha()
public final void setAlpha(double alpha)
alpha
- The new alpha valuepublic final Filter getFilter()
public final void setFilter(Filter filter)
filter
- The new Filterpublic final boolean isVisible()
public final boolean isVisible(Viewport viewport)
viewport
- The Viewport to checkpublic void draw(Graphics g, int x, int y)
g
- The Graphics context to which this SpaceObject is being drawn
this framex
- The x-coordinate in pixels on the Graphics context that
corresponds to the x-coordinate of this SpaceObject's positiony
- The y-coordinate in pixels on the Graphics context that
corresponds to the y-coordinate of this SpaceObject's position