Constructor


Arena(x: number?, y: number?, shape: table<[number, number]>?)

@param x — The x-coordinate of the center of the arena.

@param y — The y-coordinate of the center of the arena.

@param shape — The shape of the arena, represented as a table of {x, y} coordinates that form a polygon.

Arguments:

x: number?

The x-coordinate of the center of the arena.

y: number?

The y-coordinate of the center of the arena.

shape: table<[number, number]>?

The shape of the arena, represented as a table of {x, y} coordinates that form a polygon.





Methods








Arena:getBottom()

Returns:

y: number








Arena:getLeft()

Returns:

x: number


Arena:getRight()

Returns:

x: number


Arena:getTop()

Returns:

y: number






Arena:onAdd(parent: Object)

Arguments:

parent: Object

The base class of all objects in Kristal.
When added to the stage, an object will be updated and rendered.



Arena:onRemove(parent: Object)

Arguments:

parent: Object

The base class of all objects in Kristal.
When added to the stage, an object will be updated and rendered.





Arena:setShape(shape: table<[number, number]>)

Sets the arena to the polygon shape.
If line_width has been changed, this function makes the arena to reflect that change.

@param shape — A table of {x, y} coordinates that form a polygon.

Arguments:

shape: table<[number, number]>

A table of {x, y} coordinates that form a polygon.



Arena:setSize(width: number, height: number)

Sets the arena to a rectangle with dimensions width by height.
If line_width has been changed, this function makes the arena to reflect that change.

Arguments:

width: number
height: number





Fields


Arena.bg_color: table

The color of the back of the arena (Defaults to {0, 0, 0})


Arena.bottom: number

Bottommost vertical position of the arena. May be inaccurate if the arena is transformed. Use Arena:getBottom() where possible.


Arena.color: table

The color of the arena border (Defaults to {0, 0.75, 0})


Arena.left: number

Leftmost horizontal position of the arena. May be inaccurate if the arena is transformed. Use Arena:getLeft() where possible.


Arena.line_width: integer

The thickness of the arena border in pixels, must call Arena:setShape() or Arena:setSize() after changing this to make the change take effect. (Defaults to 4)


Arena.mask: ArenaMask

A mask for the arena - Any object parented to this will only render inside of the arena's bounds.



Arena.shape: table<[number, number]>

The shape of the arena, represented as a table of {x, y} coordinates that form a polygon.



Arena.top: number

Topmost vertical position of the arena. May be inaccurate if the arena is transformed. Use Arena:getLeft() where possible.


Arena.x: number

The x-coordinate of the center of the arena. May be inaccurate if the arena is transformed. Use Arena:getCenter() where possible.


Arena.y: number

The y-coordinate of the center of the arena. May be inaccurate if the arena is transformed. Use Arena:getCenter() where possible.



Undocumented