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, setRadiusclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitgetX, getYpublic CollisionCircle(int radius)
public CollisionCircle(float centerX,
float centerY,
int radius)
public void preUpdate()
public void update(GameContainer gc, float delta)
Updatableupdate in interface Updatablegc - The GameContainer of the gamedelta - The time in seconds since the last updatepublic void interpolate(GameContainer gc, float alpha)
Updatableinterpolate in interface Updatablealpha - The interpolation alpha valuepublic float getDistanceTo(Positionable positionable)
PositionablePositionable's xy coordinatesgetDistanceTo in interface Positionablepositionable - The Positionable to retrieve the distance frompublic <T extends Positionable> void addPostionChangeListener(PositionChangeListener<T> listener)
PositionablePositionChangeListener to be notified of coordinate
changesaddPostionChangeListener in interface Positionablelistener - The PositionChangeListener to addpublic <T extends Positionable> void removePositionChangeListener(PositionChangeListener<T> listener)
PositionablePositionChangeListener to stop it being notified of
coordinate changesremovePositionChangeListener in interface Positionablelistener - The PositionChangeListener to removepublic float getRenderX()
public float getRenderY()
public float getRenderRadius()
public float getPreviousX()
public float getPreviousY()
public float getPreviousRadius()