T
- The subclass of CellGame that uses the SpaceStates that can use
this RectangleHitboxpublic class RectangleHitbox<T extends CellGame> extends Hitbox<T>
A RectangleHitbox is a rectangular Hitbox with sides that remain orthogonal regardless of its angle of rotation. Horizontal and vertical flipping will flip a RectangleHitbox across axes through its position that are absolutely horizontal and vertical, respectively, but its angle of rotation affects only any other Hitboxes that are relative to it. A RectangleHitbox cannot have a negative width or height.
Constructor and Description |
---|
RectangleHitbox(CellVector relPosition,
double relLeft,
double relRight,
double relTop,
double relBottom)
Creates a new RectangleHitbox with the specified relative position and
dimensions.
|
RectangleHitbox(double relX,
double relY,
double relLeft,
double relRight,
double relTop,
double relBottom)
Creates a new RectangleHitbox with the specified relative position and
dimensions.
|
Modifier and Type | Method and Description |
---|---|
double |
getAbsBottom()
Returns the difference of the y-coordinates of this RectangleHitbox's
absolute bottom edge and absolute position.
|
double |
getAbsLeft()
Returns the difference of the x-coordinates of this RectangleHitbox's
absolute left edge and absolute position.
|
double |
getAbsRight()
Returns the difference of the x-coordinates of this RectangleHitbox's
absolute right edge and absolute position.
|
double |
getAbsTop()
Returns the difference of the y-coordinates of this RectangleHitbox's
absolute top edge and absolute position.
|
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 |
getHeight()
Returns this RectangleHitbox's height.
|
double |
getLeftEdge()
Returns the x-coordinate of this Hitbox's absolute left boundary.
|
double |
getRelBottom()
Returns the difference of the y-coordinates of this RectangleHitbox's
relative bottom edge and relative position.
|
double |
getRelLeft()
Returns the difference of the x-coordinates of this RectangleHitbox's
relative left edge and relative position.
|
double |
getRelRight()
Returns the difference of the x-coordinates of this RectangleHitbox's
relative right edge and relative position.
|
double |
getRelTop()
Returns the difference of the y-coordinates of this RectangleHitbox's
relative top edge and relative position.
|
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 |
getWidth()
Returns this RectangleHitbox's width.
|
boolean |
setRelBottom(double relBottom)
Sets the difference of the y-coordinates of this RectangleHitbox's
relative bottom edge and relative position to the specified value, if
doing so would not cause this RectangleHitbox's height to be negative.
|
boolean |
setRelLeft(double relLeft)
Sets the difference of the x-coordinates of this RectangleHitbox's
relative left edge and relative position to the specified value, if doing
so would not cause this RectangleHitbox's width to be negative.
|
boolean |
setRelRight(double relRight)
Sets the difference of the x-coordinates of this RectangleHitbox's
relative right edge and relative position to the specified value, if
doing so would not cause this RectangleHitbox's width to be negative.
|
boolean |
setRelTop(double relTop)
Sets the difference of the y-coordinates of this RectangleHitbox's
relative top edge and relative position to the specified value, if doing
so would not cause this RectangleHitbox's height to be negative.
|
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 RectangleHitbox(CellVector relPosition, double relLeft, double relRight, double relTop, double relBottom)
relPosition
- This RectangleHitbox's relative positionrelLeft
- The difference of the x-coordinates of this
RectangleHitbox's relative left edge and relative positionrelRight
- The difference of the x-coordinates of this
RectangleHitbox's relative right edge and relative positionrelTop
- The difference of the y-coordinates of this
RectangleHitbox's relative top edge and relative positionrelBottom
- The difference of the y-coordinates of this
RectangleHitbox's relative bottom edge and relative positionpublic RectangleHitbox(double relX, double relY, double relLeft, double relRight, double relTop, double relBottom)
relX
- The x-coordinate of this RectangleHitbox's relative positionrelY
- The y-coordinate of this RectangleHitbox's relative positionrelLeft
- The difference of the x-coordinates of this
RectangleHitbox's relative left edge and relative positionrelRight
- The difference of the x-coordinates of this
RectangleHitbox's relative right edge and relative positionrelTop
- The difference of the y-coordinates of this
RectangleHitbox's relative top edge and relative positionrelBottom
- The difference of the y-coordinates of this
RectangleHitbox's relative bottom edge and relative positionpublic Hitbox<T> getCopy()
Hitbox
public final double getRelLeft()
public final boolean setRelLeft(double relLeft)
relLeft
- The new relative left-side differencepublic final double getAbsLeft()
public final double getRelRight()
public final boolean setRelRight(double relRight)
relRight
- The new relative right-side differencepublic final double getAbsRight()
public final double getRelTop()
public final boolean setRelTop(double relTop)
relTop
- The new relative top-side differencepublic final double getAbsTop()
public final double getRelBottom()
public final boolean setRelBottom(double relBottom)
relBottom
- The new relative bottom-side differencepublic final double getAbsBottom()
public final double getWidth()
public final double getHeight()
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>