Module ROT.Map.Cellular

Cellular Automaton Map Generator

Functions

init (width, height[, options]) Constructor.
randomize (prob) Randomize cells.
set (x, y, value) Set.
create (callback) Create.


Functions

init (width, height[, options])
Constructor. Called with ROT.Map.Cellular:new()

Parameters:

  • width int Width in cells of the map
  • height int Height in cells of the map
  • options Options
    • born table List of neighbor counts for a new cell to be born in empty space
    • survive table List of neighbor counts for an existing cell to survive
    • topology int Topology. Accepted values: 4, 8
    • connected boolean Set to true to connect open areas on create
    • minimumZoneArea int Unconnected zones with fewer tiles than this will be turned to wall instead of being connected
randomize (prob)
Randomize cells. Random fill map with 0 or 1. Call this first when creating a map.

Parameters:

  • prob number Probability that a cell will be a floor (0). Accepts values between 0 and 1

Returns:

    ROT.Map.Cellular self
set (x, y, value)
Set. Assign a value (0 or 1) to a cell on the map

Parameters:

  • x int x-position of the cell
  • y int y-position of the cell
  • value int Value to be assigned 0-Floor 1-Wall
create (callback)
Create. Creates a map.

Parameters:

  • callback This function will be called for every cell. It must accept the following parameters:
    • x int The x-position of a cell in the map
    • y int The y-position of a cell in the map
    • value int A value representing the cell-type. 0==floor, 1==wall

Returns:

    ROT.Map.Cellular self
generated by LDoc 1.4.6 Last updated 2017-07-19 18:43:03