Arcade.Components.Size.setBodySize is a new method available on Arcade Physics Game Objects that allows you to set the body size. This replaces setSize which is now deprecated. Fix #4786

This commit is contained in:
Richard Davey 2020-07-13 14:34:23 +01:00
parent 7d1ca6815f
commit af1198dcf5

View file

@ -33,11 +33,13 @@ var Size = {
},
/**
* Sets the size of this physics body. Setting the size does not adjust the dimensions
* of the parent Game Object.
* **DEPRECATED**: Please use `setBodySize` instead.
*
* Sets the size of this physics body. Setting the size does not adjust the dimensions of the parent Game Object.
*
* @method Phaser.Physics.Arcade.Components.Size#setSize
* @since 3.0.0
* @deprecated
*
* @param {number} width - The new width of the physics body, in pixels.
* @param {number} height - The new height of the physics body, in pixels.
@ -52,6 +54,25 @@ var Size = {
return this;
},
/**
* Sets the size of this physics body. Setting the size does not adjust the dimensions of the parent Game Object.
*
* @method Phaser.Physics.Arcade.Components.Size#setBodySize
* @since 3.24.0
*
* @param {number} width - The new width of the physics body, in pixels.
* @param {number} height - The new height of the physics body, in pixels.
* @param {boolean} [center=true] - Should the body be re-positioned so its center aligns with the parent Game Object?
*
* @return {this} This Game Object.
*/
setBodySize: function (width, height, center)
{
this.body.setSize(width, height, center);
return this;
},
/**
* Sets this physics body to use a circle for collision instead of a rectangle.
*