public class LineHitbox extends Hitbox
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)
Constructs a LineHitbox with the specified relative position and
difference.
|
LineHitbox(long relX,
long relY,
long relDX,
long relDY)
Constructs a LineHitbox with the specified relative position and
difference.
|
Modifier and Type | Method and Description |
---|---|
CellVector |
getAbsDifference()
Returns this LineHitbox's absolute difference.
|
long |
getAbsDX()
Returns the x-coordinate of this LineHitbox's relative difference.
|
long |
getAbsDY()
Returns the y-coordinate of this LineHitbox's relative difference.
|
long |
getBottomEdge()
Returns the y-coordinate of this Hitbox's absolute bottom boundary.
|
LineHitbox |
getCopy()
Returns a copy of this Hitbox with its relative position at the origin
that is not flipped or rotated.
|
long |
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.
|
long |
getRelDX()
Returns the x-coordinate of this LineHitbox's relative difference.
|
long |
getRelDY()
Returns the y-coordinate of this LineHitbox's relative difference.
|
long |
getRightEdge()
Returns the x-coordinate of this Hitbox's absolute right boundary.
|
long |
getTopEdge()
Returns the y-coordinate of this Hitbox's absolute top boundary.
|
long |
getX2()
Returns the x-coordinate of this LineHitbox's second endpoint, the sum of
its absolute position and absolute difference.
|
long |
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(long relDX,
long relDY)
Sets this LineHitbox's relative difference to the specified value.
|
void |
setRelDX(long relDX)
Sets the x-coordinate of this LineHitbox's relative difference to the
specified value.
|
void |
setRelDY(long 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, getHeight, getObject, getRelAngle, getRelAngleX, getRelAngleY, getRelPosition, getRelX, getRelXFlip, getRelXSign, getRelY, getRelYFlip, getRelYSign, getWidth, 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(long relX, long relY, long relDX, long 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 final LineHitbox getCopy()
Hitbox
public final CellVector getRelDifference()
public final long getRelDX()
public final long getRelDY()
public final void setRelDifference(CellVector difference)
difference
- The new relative differencepublic final void setRelDifference(long relDX, long relDY)
relDX
- The x-coordinate of the new relative differencerelDY
- The y-coordinate of the new relative differencepublic final void setRelDX(long relDX)
relDX
- The x-coordinate of the new relative differencepublic final void setRelDY(long relDY)
relDY
- The y-coordinate of the new relative differencepublic final CellVector getAbsDifference()
public final long getAbsDX()
public final long getAbsDY()
public final CellVector getPosition2()
public final long getX2()
public final long getY2()
public final long getLeftEdge()
Hitbox
getLeftEdge
in class Hitbox
public final long getRightEdge()
Hitbox
getRightEdge
in class Hitbox
public final long getTopEdge()
Hitbox
getTopEdge
in class Hitbox
public final long getBottomEdge()
Hitbox
getBottomEdge
in class Hitbox