T
- a subclass inheriting Entity, used in order to return this as a T instead of an Entity.public abstract class Entity<T extends Entity<?>>
extends java.lang.Object
The graphical counterpart's coordinates are converted from world units to pixel coordinates.
Modifier and Type | Method and Description |
---|---|
double |
getAlpha()
Returns the alpha of this
Entity as a percentage. |
int |
getId()
Returns a unique identifier for this
Entity . |
double |
getRotation()
Returns the rotation of this
Entity in radians. |
double |
getScaleX()
Returns the horizontal scale of this
Entity as a percentage. |
double |
getScaleY()
Returns the vertical scale of this
Entity as a percentage. |
int |
getX()
Returns the X coordinate of this
Entity in world units. |
int |
getY()
Returns the Y coordinate of this
Entity in world units. |
int |
getZIndex()
Returns the z-index of this
Entity used to compute the display order for overlapping entities. |
boolean |
isVisible()
Returns whether this
Entity is flagged to be drawn on screen. |
T |
setAlpha(double alpha)
Sets the alpha of this
Entity as a percentage. |
T |
setAlpha(double alpha,
Curve curve)
Sets the alpha of this
Entity as a percentage. |
T |
setRotation(double rotation)
Sets the rotation of this
Entity in radians. |
T |
setRotation(double rotation,
Curve curve)
Sets the rotation of this
Entity in radians. |
T |
setScale(double scale)
Sets both the horizontal and vertical scale of this
Entity to the same percentage. |
T |
setScale(double scale,
Curve curve)
Sets both the horizontal and vertical scale of this
Entity to the same percentage. |
T |
setScaleX(double scaleX)
Sets the horizontal scale of this
Entity as a percentage. |
T |
setScaleX(double scaleX,
Curve curve)
Sets the horizontal scale of this
Entity as a percentage. |
T |
setScaleY(double scaleY)
Sets the vertical scale of this
Entity as a percentage. |
T |
setScaleY(double scaleY,
Curve curve)
Sets the vertical scale of this
Entity as a percentage. |
T |
setVisible(boolean visible)
Flags this
Entity to be drawn on screen or not. |
T |
setX(int x)
Sets the X coordinate of this
Entity in world units. |
T |
setX(int x,
Curve curve)
Sets the X coordinate of this
Entity in world units. |
T |
setY(int y)
Sets the Y coordinate of this
Entity in world units. |
T |
setY(int y,
Curve curve)
Sets the Y coordinate of this
Entity in world units. |
T |
setZIndex(int zIndex)
Sets the z-index of this
Entity used to compute the display order for overlapping entities. |
public int getId()
Entity
.public T setX(int x)
Entity
in world units.x
- the X coordinate for this Entity
.Entity
.public T setX(int x, Curve curve)
Entity
in world units.x
- the X coordinate for this Entity
.curve
- the transition to animate between values of this property.Entity
.public T setY(int y)
Entity
in world units.y
- the Y coordinate for this Entity
.Entity
.public T setY(int y, Curve curve)
Entity
in world units.y
- the Y coordinate for this Entity
.curve
- the transition to animate between values of this property.Entity
.public T setZIndex(int zIndex)
Entity
used to compute the display order for overlapping entities.
An Entity
with a higher z-index is displayed over one with a smaller z-index.
In case of equal values, the most recently created Entity
will be on top.
zIndex
- the z-index for this Entity
.Entity
.public T setScaleX(double scaleX)
Entity
as a percentage.scaleX
- the horizontal scale for this Entity
.Entity
.public T setScaleX(double scaleX, Curve curve)
Entity
as a percentage.scaleX
- the horizontal scale for this Entity
.curve
- the transition to animate between values of this property.Entity
.public T setScaleY(double scaleY)
Entity
as a percentage.scaleY
- the vertical scale for this Entity
.Entity
.public T setScaleY(double scaleY, Curve curve)
Entity
as a percentage.scaleY
- the vertical scale for this Entity
.curve
- the transition to animate between values of this property.Entity
.public T setAlpha(double alpha)
Entity
as a percentage.
1 is opaque and 0 is invisible.
alpha
- the alpha for this Entity
.Entity
.java.lang.IllegalArgumentException
- if alpha < 0 or alpha > 1public T setAlpha(double alpha, Curve curve)
Entity
as a percentage.
1 is opaque and 0 is invisible.
alpha
- the alpha for this Entity
.curve
- the transition to animate between values of this property.Entity
.java.lang.IllegalArgumentException
- if alpha < 0 or alpha > 1public T setScale(double scale)
Entity
to the same percentage.scale
- the scale for this Entity
.Entity
.public T setScale(double scale, Curve curve)
Entity
to the same percentage.scale
- the scale for this Entity
.curve
- the transition to animate between values of this property.Entity
.public T setRotation(double rotation)
Entity
in radians.rotation
- the rotation for this Entity
.Entity
.public T setRotation(double rotation, Curve curve)
Entity
in radians.rotation
- the rotation for this Entity
.curve
- the transition to animate between values of this property.Entity
.public T setVisible(boolean visible)
Entity
to be drawn on screen or not.
Default is true.
visible
- the value for this Entity
's visible flag.Entity
.public int getX()
Entity
in world units.Entity
.public int getY()
Entity
in world units.Entity
.public int getZIndex()
Entity
used to compute the display order for overlapping entities.Entity
.public double getScaleX()
Entity
as a percentage.
Default is 1.
Entity
.public double getScaleY()
Entity
as a percentage.
Default is 1.
Entity
.public double getAlpha()
Entity
as a percentage.
Default is 1.
Entity
.public double getRotation()
Entity
in radians.Entity
.public boolean isVisible()
Entity
is flagged to be drawn on screen.Entity
.