Phaser API Documentation

  Version: 
setBounds([x], [y], [width], [height], [thickness], [left], [right], [top], [bottom])

Description:

Sets the bounds of the Physics world to match the given world pixel dimensions. You can optionally set which 'walls' to create: left, right, top or bottom. If none of the walls are given it will default to use the walls settings it had previously. I.e. if you previously told it to not have the left or right walls, and you then adjust the world size the newly created bounds will also not have the left and right walls. Explicitly state them in the parameters to override this.

Parameters:

name type arguments Default description
x number <optional> 0

The x coordinate of the top-left corner of the bounds.

y number <optional> 0

The y coordinate of the top-left corner of the bounds.

width number <optional>

The width of the bounds.

height number <optional>

The height of the bounds.

thickness number <optional> 64

The thickness of each wall, in pixels.

left boolean <optional> true

If true will create the left bounds wall.

right boolean <optional> true

If true will create the right bounds wall.

top boolean <optional> true

If true will create the top bounds wall.

bottom boolean <optional> true

If true will create the bottom bounds wall.

Returns:
Description:

This Matter World object.

Since: 3.0.0