public class CollisionPoint extends Point implements Positionable
Point
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 |
---|
CollisionPoint() |
CollisionPoint(float x,
float y) |
CollisionPoint(Point point) |
Modifier and Type | Method and Description |
---|---|
com.badlogic.gdx.math.Vector2 |
add(float x,
float y) |
<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 |
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 |
com.badlogic.gdx.math.Vector2 |
set(float x,
float y) |
com.badlogic.gdx.math.Vector2 |
sub(float x,
float y) |
void |
update(GameContainer gc,
float delta)
Updates the game screen
|
add, equals, equals, getDistanceTo, getDistanceTo, getX, getY, isOnLineBetween, rotateAround, set, sub
angle, angle, angleRad, angleRad, clamp, cpy, crs, crs, dot, dot, dot, dst, dst, dst, dst2, dst2, dst2, epsilonEquals, epsilonEquals, equals, hashCode, hasOppositeDirection, hasSameDirection, interpolate, isCollinear, isCollinear, isCollinearOpposite, isCollinearOpposite, isOnLine, isOnLine, isPerpendicular, isPerpendicular, isUnit, isUnit, isZero, isZero, len, len, len2, len2, lerp, limit, limit2, mul, mulAdd, mulAdd, nor, rotate, rotate90, rotateRad, scl, scl, scl, setAngle, setAngleRad, setLength, setLength2, setZero, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
getX, getY
public CollisionPoint()
public CollisionPoint(float x, float y)
public CollisionPoint(Point point)
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 com.badlogic.gdx.math.Vector2 set(float x, float y)
set
in class com.badlogic.gdx.math.Vector2
public com.badlogic.gdx.math.Vector2 add(float x, float y)
add
in class com.badlogic.gdx.math.Vector2
public com.badlogic.gdx.math.Vector2 sub(float x, float y)
sub
in class com.badlogic.gdx.math.Vector2
public float getRenderX()
public float getRenderY()