Skip to main content

Zone

Methods

removeBoundary

Removes a boundary instance from the zone.

zone:removeBoundary(i: number) -> none

mapPosition

Maps each element to a boundary within the zone.

zone:mapPosition(elements: array, position: object) -> Map

assignBoundaries

Assigns each element a boundary in the zone.

zone:assignBoundaries(elements: array, position: object, offset: object) -> none

draw

Draws all the boundaries on the canvas.

zone:draw() -> none

cleanup

Removes all references of the instance.

zone:cleanup() -> none

proximity

Returns true if p1 is within amnt of the instance.

zone:proximity(p1: object, amnt: number) -> boolean

collision

Returns true if the sprite collides with a boundary.

zone:collision(sprite: sprite instance, x: number, y: number) -> boolean

proximitySort

Sorts the boundaries by proximity.

zone:proximitySort(sprite: sprite instance) -> none

Properties

zoneData

  • Type: array

The boundary data to create a zone from.