Phaser API Documentation

  Version: 
setSizeToFrame(frame)

Description:

Sets the size of this Game Object to be that of the given Frame.

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
frame Phaser.Textures.Frame

The frame to base the size of this Game Object on.

Returns:
Description:

This Game Object instance.

Since: 3.0.0