Phaser API Documentation

  Version: 
setBounds(x, y, width, height, [checkLeft], [checkRight], [checkUp], [checkDown])

Description:

Sets the position, size and properties of the World boundary.

The World boundary is an invisible rectangle that defines the edges of the World. If a Body is set to collide with the world bounds then it will automatically stop when it reaches any of the edges. You can optionally set which edges of the boundary should be checked against.

Parameters:

name type arguments description
x number

The top-left x coordinate of the boundary.

y number

The top-left y coordinate of the boundary.

width number

The width of the boundary.

height number

The height of the boundary.

checkLeft boolean <optional>

Should bodies check against the left edge of the boundary?

checkRight boolean <optional>

Should bodies check against the right edge of the boundary?

checkUp boolean <optional>

Should bodies check against the top edge of the boundary?

checkDown boolean <optional>

Should bodies check against the bottom edge of the boundary?

Returns:
Description:

This World object.

Examples:
Since: 3.0.0