Phaser API Documentation

  Version: 
stack(x, y, columns, rows, columnGap, rowGap, callback)

Description:

Create a new composite containing bodies created in the callback in a grid arrangement.

This function uses the body bounds to prevent overlaps.

Parameters:

name type description
x number

The horizontal position of this composite in the world.

y number

The vertical position of this composite in the world.

columns number

The number of columns in the grid.

rows number

The number of rows in the grid.

columnGap number

The distance between each column.

rowGap number

The distance between each row.

callback function

The callback that creates the stack.

Returns:
Description:

A new composite containing objects created in the callback.

Type:
  • MatterJS.CompositeType
Since: 3.0.0