Class: Box

Maze~Box(left, up, right, down)

Box object with four walls.

Constructor

new Box(left, up, right, down)

Parameters:
Name Type Default Description
left boolean true

Default visibility of the left wall.

up boolean true

Default visibility of the top wall.

right boolean true

Default visibility of the right wall.

down boolean true

Default visibility of the bottom wall.

Source:

Members

(static, readonly) WALLS :string

Valid walls to use for Box#toggleWall and Box#toggleOpposite methods.

Type:
  • string
Properties:
Name Type Description
LEFT string

String value for the left wall.

UP string

String value for the top wall.

RIGHT string

String value for the right wall.

DOWN string

String value for the bottom wall.

Source:

down

Properties:
Name Type Description
down boolean

Bottom-side wall of the box.

Source:

left

Properties:
Name Type Description
left boolean

Left-side wall of the box.

Source:
Properties:
Name Type Description
right boolean

Right-side wall of the box.

Source:

up

Properties:
Name Type Description
up boolean

Top-side wall of the box.

Source:

Methods

setWalls(enable)

Sets all of the walls either on or off.

Parameters:
Name Type Description
enable boolean

To toggle on or off.

Source:

toggleOpposite(wall, enable)

Wrapper method to change the visibility of the opposite Wall in the box based off of a string. Felt much easier to just use a switch statement here rather than reuse Box.toggleWall.

Parameters:
Name Type Description
wall Box.WALLS

What wall that will be the opposite of the toggled wall.

enable boolean

To toggle on or off.

Source:
Example
Box.toggleOpposite('LEFT', true) // Toggles the right wall on.

toggleWall(wall, enable)

Wrapper method to change the visibility of a given Wall in the box based off of a string.

Parameters:
Name Type Description
wall Box.WALLS

What wall to toggle.

enable boolean

To toggle on or off.

Source: