public interface Positionable extends Updatable
Modifier and Type | Method and Description |
---|---|
<T extends Positionable> |
addPostionChangeListener(PositionChangeListener<T> listener)
Adds a
PositionChangeListener to be notified of coordinate
changes |
float |
getDistanceTo(float x,
float y)
Returns this distance between this object's x,y coordinates and the
provided xy coordinates
|
float |
getDistanceTo(Point point)
Returns this distance between this object's x,y coordinates and the
provided
Point 's xy coordinates |
float |
getDistanceTo(Positionable positionable)
Returns this distance between this object's x,y coordinates and the
provided
Positionable 's xy coordinates |
int |
getId()
Returns the unique id of this object
|
int |
getRenderX()
Returns the render x coordinate of this object
|
int |
getRenderY()
Returns the render y coordinate of this object
|
float |
getX()
Returns the x coordinate of this object
|
float |
getY()
Returns the y coordinate of this object
|
void |
moveTowards(float x,
float y,
float speed)
Moves this
Positionable towards a coordinate |
void |
moveTowards(Positionable positionable,
float speed)
Moves this
Positionable towards another Positionable |
<T extends Positionable> |
removePositionChangeListener(PositionChangeListener<T> listener)
Removes a
PositionChangeListener to stop it being notified of
coordinate changes |
void |
setX(float x)
Sets the x coordinate of this object
|
void |
setY(float y)
Sets the y coordinate of this object
|
interpolate, update
int getId()
float getX()
float getY()
void setX(float x)
x
- The x coordinatevoid setY(float y)
y
- The y coordinateint getRenderX()
int getRenderY()
float getDistanceTo(Positionable positionable)
Positionable
's xy coordinatespositionable
- The Positionable
to retrieve the distance fromfloat getDistanceTo(Point point)
Point
's xy coordinatespoint
- The Point
to retrieve the distance fromfloat getDistanceTo(float x, float y)
x
- The x coordinate to measure distance toy
- The y coordinate to measure distance tovoid moveTowards(float x, float y, float speed)
Positionable
towards a coordinatex
- The target x coordinatey
- The target y coordinatespeed
- The amount to move byvoid moveTowards(Positionable positionable, float speed)
Positionable
towards another Positionable
positionable
- The target Positionable
speed
- The amount to move by<T extends Positionable> void addPostionChangeListener(PositionChangeListener<T> listener)
PositionChangeListener
to be notified of coordinate
changeslistener
- The PositionChangeListener
to add<T extends Positionable> void removePositionChangeListener(PositionChangeListener<T> listener)
PositionChangeListener
to stop it being notified of
coordinate changeslistener
- The PositionChangeListener
to remove