public class CollisionCircle extends Circle implements Positionable
Circle
that allows for interpolation. Game
objects can use this class to move around the game world and retrieve the
appropriate rendering coordinates after interpolating between the previous
and current position.Constructor and Description |
---|
CollisionCircle(float centerX,
float centerY,
int radius) |
CollisionCircle(int radius) |
Modifier and Type | Method and Description |
---|---|
<T extends Positionable> |
addPostionChangeListener(PositionChangeListener<T> listener)
Adds a
PositionChangeListener to be notified of coordinate
changes |
float |
getDistanceTo(Positionable positionable)
Returns this distance between this object's x,y coordinates and the
provided
Positionable 's xy coordinates |
float |
getPreviousRadius() |
float |
getPreviousX() |
float |
getPreviousY() |
float |
getRenderRadius() |
float |
getRenderX() |
float |
getRenderY() |
void |
interpolate(GameContainer gc,
float alpha)
Interpolate between the previous and current state
|
void |
preUpdate()
This method needs to be called at the start of each frame
before any changes are made to this object
|
<T extends Positionable> |
removePositionChangeListener(PositionChangeListener<T> listener)
Removes a
PositionChangeListener to stop it being notified of
coordinate changes |
void |
setCenter(float x,
float y) |
void |
setX(float x) |
void |
setY(float y) |
void |
update(GameContainer gc,
float delta)
Updates the game screen
|
draw, getDistanceTo, getDistanceTo, getNumberOfSides, getRadius, getX, getY, intersects, lerp, set, setRadius
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getX, getY
public CollisionCircle(int radius)
public CollisionCircle(float centerX, float centerY, int radius)
public void preUpdate()
public void update(GameContainer gc, float delta)
Updatable
update
in interface Updatable
gc
- The GameContainer
of the gamedelta
- The time in seconds since the last updatepublic void interpolate(GameContainer gc, float alpha)
Updatable
interpolate
in interface Updatable
alpha
- The interpolation alpha valuepublic float getDistanceTo(Positionable positionable)
Positionable
Positionable
's xy coordinatesgetDistanceTo
in interface Positionable
positionable
- The Positionable
to retrieve the distance frompublic <T extends Positionable> void addPostionChangeListener(PositionChangeListener<T> listener)
Positionable
PositionChangeListener
to be notified of coordinate
changesaddPostionChangeListener
in interface Positionable
listener
- The PositionChangeListener
to addpublic <T extends Positionable> void removePositionChangeListener(PositionChangeListener<T> listener)
Positionable
PositionChangeListener
to stop it being notified of
coordinate changesremovePositionChangeListener
in interface Positionable
listener
- The PositionChangeListener
to removepublic float getRenderX()
public float getRenderY()
public float getRenderRadius()
public float getPreviousX()
public float getPreviousY()
public float getPreviousRadius()