Class: LevelBuilder

LevelBuilder(dimension)

Level Builder for LevelZ

Constructor

new LevelBuilder(dimension)

Constructs a new Level Builder.
Parameters:
Name Type Description
dimension Dimension The dimension for the level.
Source:
Example
new LevelBuilder(Dimension.TWO)

Members

blocks :Set.<LevelObject>

The blocks of the level.
Type:
Source:

dimension :number

The dimension of the level.
Type:
  • number
Source:

headers :Map.<string, any>

The headers of the level.
Type:
  • Map.<string, any>
Source:

spawn

Sets the spawn point for the level.
Source:

Methods

block(block)

Adds a Block to the level.
Parameters:
Name Type Description
block LevelObject The level object to add to the level.
Source:
Throws:
Invalid coordinate; must be 2D or 3D (according to the dimension)

block(name, coordinate, properties)

Adds a Block to the level.
Parameters:
Name Type Description
name string The name of the block.
coordinate Coordinate | Array.<number> The coordinate of the block.
properties Map.<string, any> | Object.<string, any> The properties of the block.
Source:

build() → {Level}

Builds the level.
Source:
Returns:
The built level.
Type
Level
Example
LevelBuilder.create2D().block('grass', [0, 0]).build()
Sets a header value.
Parameters:
Name Type Description
key string The key of the header
value * The value of the header
Source:

(static) create2D() → {LevelBuilder}

Creates a new 2D Level Builder.
Source:
Returns:
A new 2D Level Builder.
Type
LevelBuilder

(static) create3D() → {LevelBuilder}

Creates a new 3D Level Builder.
Source:
Returns:
A new 3D Level Builder.
Type
LevelBuilder