Rectangle

Rectangle

A rectangular hitbox. Remember that this rectangle describes the item as if its settings were x=0, y=0, scale=1, rotation=0.

Constructor

new Rectangle(width, height, xopt, yopt)

Source:
Implements:
Parameters:
Name Type Attributes Default Description
width number The width of the rectangle.
height number The height of the rectangle.
x number <optional>
0 The x offset of the rectangle.
y number <optional>
0 The y offset of the rectangle.

Members

height :number

Description:
  • The height of the rectangle.
Source:
The height of the rectangle.
Type:
  • number

width :number

Description:
  • The width of the rectangle.
Source:
The width of the rectangle.
Type:
  • number

x :number

Description:
  • The x coordinate of the rectangle.
Source:
The x coordinate of the rectangle.
Type:
  • number

y :number

Description:
  • The y coordinate of the rectangle.
Source:
The y coordinate of the rectangle.
Type:
  • number

Methods

contains(point) → {boolean}

Description:
  • Determines if a point is inside the rectangle.
Source:
Implements:
Parameters:
Name Type Description
point module:shared.Point2D The point to test.
Returns:
true if the point is inside the rectangle, false otherwise.
Type
boolean