Phaser API Documentation

  Version: 
setSize([width], [height], [center])

Description:

Sizes and positions this Body, as a rectangle. Modifies the Body offset if center is true (the default). Resets the width and height to match current frame, if no width and height provided and a frame is found.

Parameters:

name type arguments Default description
width number <optional>

The width of the Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame width.

height number <optional>

The height of the Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame height.

center boolean <optional> true

Modify the Body's offset, placing the Body's center on its Game Object's center. Only works if the Game Object has the getCenter method.

Returns:
Description:

This Body object.

Since: 3.0.0