Phaser API Documentation

  Version: 
setSize(width, height)

Description:

Sets the internal size of this Game Object, as used for frame or physics body creation.

This will not change the size that the Game Object is rendered in-game. For that you need to either set the scale of the Game Object (setScale) or call the setDisplaySize method, which is the same thing as changing the scale but allows you to do so by giving pixel values.

If you have enabled this Game Object for input, changing the size will not change the size of the hit area. To do this you should adjust the input.hitArea object directly.

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.4.0