fill

fun fill(column: Int, row: Int, shape: SolidShape = SolidShape.BOX, tags: SolidTags = SolidTags.NONE, material: Material = Material.DEFAULT): Solid(source)

Fills cell (column, row) with a solid of shape carrying tags and material, and returns it. A solid already in the cell is replaced.

Throws

if the cell is outside the grid.

Samples

// A level 40 tiles across and 20 down, each 16 units: a floor, and a slope up to a ledge.
val grid = SolidGrid(columns = 40, rows = 20, tileSize = 16f)
for (column in 0 until 40) grid.fill(column, 19)
grid.fill(10, 18, shape = SolidShape.RISING)
grid.fill(11, 18)
val world = PhysicsWorld()
world.solids = grid
assertPrints(grid.isSolidAt(8f, 310f), "true")
assertPrints(grid.atOrNull(11, 18)?.shape, "BOX")
assertPrints(grid.atOrNull(12, 18), "null")