Phaser API Documentation

trapezoid(x, y, width, height, slope, [options])


Creates a new rigid trapezoidal Body and adds it to the World.


name type arguments description
x number

The X coordinate of the center of the Body.

y number

The Y coordinate of the center of the Body.

width number

The width of the trapezoid Body.

height number

The height of the trapezoid Body.

slope number

The slope of the trapezoid. 0 creates a rectangle, while 1 creates a triangle. Positive values make the top side shorter, while negative values make the bottom side shorter.

options Phaser.Types.Physics.Matter.MatterBodyConfig <optional>

An optional Body configuration object that is used to set initial Body properties on creation.


A Matter JS Body.

  • MatterJS.BodyType
Since: 3.0.0