mirror of
https://github.com/photonstorm/phaser
synced 2024-11-24 05:33:35 +00:00
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:
parent
7d1ca6815f
commit
af1198dcf5
1 changed files with 23 additions and 2 deletions
|
@ -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.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue