class flixel.addons.tile.FlxCaveGenerator

Available on all platforms

This class uses the cellular automata algorithm * to generate very sexy caves. * (Coded by Eddie Lee, October 16, 2010)

Class Fields

static function convertMatrixToString(Matrix:Array<Array<Int>>):String

Convert a matrix generated via generateCaveMatrix() into data * that is usable by FlxTilemap. * *

Matrix

A matrix of data *

returns

A string that is usuable for FlxTilemap.loadMap()

static function generateCaveMatrix(Columns:Int, Rows:Int, ?SmoothingIterations:Int = 6, ?WallRatio:Float = 0.5f):Array<Array<Int>>

Generate the matrix (2-dimensional array of Ints) for a cave. * *

Columns

Number of columns for the matrix *

Rows

Number of rows for the matrix *

SmoothingIterations

How many times do you want to "smooth" the caev - the higher the smoother, but slower *

WallRatio

Chance for a tile to become a wall - the closer the value is to 1.0, the more walls there are *

returns

Returns a matrix of a cave!

static function generateCaveString(Columns:Int, Rows:Int, ?SmoothingIterations:Int = 6, ?WallRatio:Float = 0.5f):String

Generates a new cave matrix via generateCaveMatrix() and returns it in a format * usable by FlxTilemap.load() via convertMatrixToString(). * *

Columns

Number of columns for the matrix *

Rows

Number of rows for the matrix *

SmoothingIterations

How many times do you want to "smooth" the caev - the higher the smoother, but slower *

WallRatio

Chance for a tile to become a wall - the closer the value is to 1.0, the more walls there are *

returns

A cave string that is usable by FlxTilemap.loadMap()