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,
long relLeft,
long relRight,
long relTop,
long relBottom)
Creates a new RectangleHitbox with the specified relative position and
dimensions.
|
RectangleHitbox(long relX,
long relY,
long relLeft,
long relRight,
long relTop,
long relBottom)
Creates a new RectangleHitbox with the specified relative position and
dimensions.
|
Modifier and Type | Method and Description |
---|---|
long |
getAbsBottom()
Returns the difference of the y-coordinates of this RectangleHitbox's
absolute bottom edge and absolute position.
|
long |
getAbsLeft()
Returns the difference of the x-coordinates of this RectangleHitbox's
absolute left edge and absolute position.
|
long |
getAbsRight()
Returns the difference of the x-coordinates of this RectangleHitbox's
absolute right edge and absolute position.
|
long |
getAbsTop()
Returns the difference of the y-coordinates of this RectangleHitbox's
absolute top edge and absolute position.
|
long |
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.
|
long |
getHeight()
Returns this RectangleHitbox's height.
|
long |
getLeftEdge()
Returns the x-coordinate of this Hitbox's absolute left boundary.
|
long |
getRelBottom()
Returns the difference of the y-coordinates of this RectangleHitbox's
relative bottom edge and relative position.
|
long |
getRelLeft()
Returns the difference of the x-coordinates of this RectangleHitbox's
relative left edge and relative position.
|
long |
getRelRight()
Returns the difference of the x-coordinates of this RectangleHitbox's
relative right edge and relative position.
|
long |
getRelTop()
Returns the difference of the y-coordinates of this RectangleHitbox's
relative top edge and relative position.
|
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 |
getWidth()
Returns this RectangleHitbox's width.
|
boolean |
setRelBottom(long 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(long 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(long 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(long 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, long relLeft, long relRight, long relTop, long 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(long relX, long relY, long relLeft, long relRight, long relTop, long 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 long getRelLeft()
public final boolean setRelLeft(long relLeft)
relLeft
- The new relative left-side differencepublic final long getAbsLeft()
public final long getRelRight()
public final boolean setRelRight(long relRight)
relRight
- The new relative right-side differencepublic final long getAbsRight()
public final long getRelTop()
public final boolean setRelTop(long relTop)
relTop
- The new relative top-side differencepublic final long getAbsTop()
public final long getRelBottom()
public final boolean setRelBottom(long relBottom)
relBottom
- The new relative bottom-side differencepublic final long getAbsBottom()
public final long getWidth()
public final long getHeight()
public final long getLeftEdge()
Hitbox
getLeftEdge
in class Hitbox<T extends CellGame>
public final long getRightEdge()
Hitbox
getRightEdge
in class Hitbox<T extends CellGame>
public final long getTopEdge()
Hitbox
getTopEdge
in class Hitbox<T extends CellGame>
public final long getBottomEdge()
Hitbox
getBottomEdge
in class Hitbox<T extends CellGame>