add

fun add(x: Float, y: Float, width: Float, height: Float): Hitbox2D

Adds a rectangular hitbox to this hitbox. The resulting hitbox contains all points that are inside either the original hitbox or the new rectangle.

Return

A new Hitbox2D representing the union of the original hitbox and the new rectangle.

Parameters

x

The x coordinate of the top-left corner of the rectangle.

y

The y coordinate of the top-left corner of the rectangle.

width

The width of the rectangle.

height

The height of the rectangle.


fun add(other: Hitbox2D): Hitbox2D

Combines this hitbox with another hitbox using a union operation. The resulting hitbox contains all points that are inside either of the original hitboxes.

Return

A new Hitbox2D representing the union of the two hitboxes.

Parameters

other

The other hitbox to combine with.