T
- The subclass of CellGame that uses the SpaceStates that can use
this LineHitboxpublic class LineHitbox<T extends CellGame> extends Hitbox<T>
A LineHitbox is a Hitbox shaped like a line segment, with one endpoint being its position and the other being the sum of its position and a vector called its difference.
Constructor and Description |
---|
LineHitbox(CellVector relPosition,
CellVector relDifference)
Creates a new LineHitbox with the specified relative position and
difference.
|
LineHitbox(double relX,
double relY,
double relDX,
double relDY)
Creates a new LineHitbox with the specified relative position and
difference.
|
Modifier and Type | Method and Description |
---|---|
CellVector |
getAbsDifference()
Returns this LineHitbox's absolute difference.
|
double |
getAbsDX()
Returns the x-coordinate of this LineHitbox's relative difference.
|
double |
getAbsDY()
Returns the y-coordinate of this LineHitbox's relative difference.
|
double |
getBottomEdge()
Returns the y-coordinate of this Hitbox's absolute bottom boundary.
|
Hitbox<T> |
getCopy()
Returns a copy of this Hitbox with its relative position at the origin
that is not flipped or rotated.
|
double |
getLeftEdge()
Returns the x-coordinate of this Hitbox's absolute left boundary.
|
CellVector |
getPosition2()
Returns the position of this LineHitbox's second endpoint, the sum of its
absolute position and absolute difference.
|
CellVector |
getRelDifference()
Returns this LineHitbox's relative difference.
|
double |
getRelDX()
Returns the x-coordinate of this LineHitbox's relative difference.
|
double |
getRelDY()
Returns the y-coordinate of this LineHitbox's relative difference.
|
double |
getRightEdge()
Returns the x-coordinate of this Hitbox's absolute right boundary.
|
double |
getTopEdge()
Returns the y-coordinate of this Hitbox's absolute top boundary.
|
double |
getX2()
Returns the x-coordinate of this LineHitbox's second endpoint, the sum of
its absolute position and absolute difference.
|
double |
getY2()
Returns the y-coordinate of this LineHitbox's second endpoint, the sum of
its absolute position and absolute difference.
|
void |
setRelDifference(CellVector difference)
Sets this LineHitbox's relative difference to the specified value.
|
void |
setRelDifference(double relDX,
double relDY)
Sets this LineHitbox's relative difference to the specified value.
|
void |
setRelDX(double relDX)
Sets the x-coordinate of this LineHitbox's relative difference to the
specified value.
|
void |
setRelDY(double relDY)
Sets the y-coordinate of this LineHitbox's relative difference to the
specified value.
|
angleTo, changeRelAngle, changeRelPosition, changeRelPosition, changeRelX, changeRelY, distanceTo, getAbsAngle, getAbsAngleX, getAbsAngleY, getAbsPosition, getAbsX, getAbsXFlip, getAbsXSign, getAbsY, getAbsYFlip, getAbsYSign, getComponentOf, getGameState, getObject, getRelAngle, getRelAngleX, getRelAngleY, getRelPosition, getRelX, getRelXFlip, getRelXSign, getRelY, getRelYFlip, getRelYSign, isSolid, overlap, overlaps, relFlipX, relFlipY, setRelAngle, setRelPosition, setRelPosition, setRelX, setRelXFlip, setRelY, setRelYFlip, setSolid, setSurfaceSolid, surfaceIsSolid
public LineHitbox(CellVector relPosition, CellVector relDifference)
relPosition
- This LineHitbox's relative positionrelDifference
- This LineHitbox's relative differencepublic LineHitbox(double relX, double relY, double relDX, double relDY)
relX
- The x-coordinate of this LineHitbox's relative positionrelY
- The y-coordinate of this LineHitbox's relative positionrelDX
- The x-coordinate of this LineHitbox's relative differencerelDY
- The y-coordinate of this LineHitbox's relative differencepublic Hitbox<T> getCopy()
Hitbox
public final CellVector getRelDifference()
public final double getRelDX()
public final double getRelDY()
public final void setRelDifference(CellVector difference)
difference
- The new relative differencepublic final void setRelDifference(double relDX, double relDY)
relDX
- The x-coordinate of the new relative differencerelDY
- The y-coordinate of the new relative differencepublic final void setRelDX(double relDX)
relDX
- The x-coordinate of the new relative differencepublic final void setRelDY(double relDY)
relDY
- The y-coordinate of the new relative differencepublic final CellVector getAbsDifference()
public final double getAbsDX()
public final double getAbsDY()
public final CellVector getPosition2()
public final double getX2()
public final double getY2()
public final double getLeftEdge()
Hitbox
getLeftEdge
in class Hitbox<T extends CellGame>
public final double getRightEdge()
Hitbox
getRightEdge
in class Hitbox<T extends CellGame>
public final double getTopEdge()
Hitbox
getTopEdge
in class Hitbox<T extends CellGame>
public final double getBottomEdge()
Hitbox
getBottomEdge
in class Hitbox<T extends CellGame>