public class Rectangle extends Collider
Constructor and Description |
---|
Rectangle()
Creates a rectangle at lower-left position (0,0) with width/height of zero
|
Rectangle(float width,
float height)
Creates a rectangle at lower-left position (0,0) with given width/height
|
Rectangle(float x,
float y,
float width,
float height)
Creates a rectangle at lower-left position (x,y) with given width/height
|
Modifier and Type | Method and Description |
---|---|
float |
getHeight()
Gets the height of the rectangle
|
float |
getTop()
Returns the y-position of the top of the collider in world units.
|
float |
getWidth()
Retrieves the width of the rectangle
|
boolean |
insideCamera(com.badlogic.gdx.graphics.OrthographicCamera camera)
Returns true if this rectangle collider is inside the bounds of the camera.
|
boolean |
intersects(Collider c)
Returns true if this rectangle intersects with another collider
|
boolean |
intersects(Vector2 point)
Returns true if this point is within the rectangle.
|
void |
setHeight(float height)
Sets the height of the rectangle
|
void |
setSize(float width,
float height)
Sets the width and height of the rectangle from its bottom-left position.
|
void |
setWidth(float width)
Sets the width of the rectangle
|
java.lang.String |
toString() |
getPosition, setPosition
public Rectangle()
public Rectangle(float width, float height)
public Rectangle(float x, float y, float width, float height)
public boolean intersects(Collider c)
intersects
in class Collider
public boolean intersects(Vector2 point)
intersects
in class Collider
public boolean insideCamera(com.badlogic.gdx.graphics.OrthographicCamera camera)
insideCamera
in class Collider
public float getTop()
public void setSize(float width, float height)
public float getWidth()
public void setWidth(float width)
public float getHeight()
public void setHeight(float height)
public java.lang.String toString()
toString
in class java.lang.Object