Phaser API Documentation

  Version: 
setSize(width, height)

Description:

Sets the size of this Game Object.

For a Nine Slice Game Object this means it will be stretched (or shrunk) horizontally and vertically depending on the dimensions given to this method, in accordance with how it has been configured for the various corner sizes.

If this is a 3-slice object, you can only stretch it horizontally and changing the height will be ignored.

If you have enabled this Game Object for input, changing the size will also change the size of the hit area.

Parameters:

name type description
width number

The width of this Game Object.

height number

The height of this Game Object.

Returns:
Description:

This Game Object instance.

Since: 3.60.0