Added refreshBody method and jsdocs

This commit is contained in:
Richard Davey 2018-02-15 01:52:01 +00:00
parent 7df00ccb6f
commit aa9cac4ba8

View file

@ -18,18 +18,16 @@ var Enable = {
* @method Phaser.Physics.Arcade.Components.Enable#enableBody
* @since 3.0.0
*
* @param {[type]} reset - [description]
* @param {[type]} x - [description]
* @param {[type]} y - [description]
* @param {[type]} enableGameObject - [description]
* @param {[type]} showGameObject - [description]
* @param {boolean} reset - [description]
* @param {number} x - [description]
* @param {number} y - [description]
* @param {boolean} enableGameObject - [description]
* @param {boolean} showGameObject - [description]
*
* @return {[type]} [description]
* @return {Phaser.GameObjects.GameObject} This Game Object.
*/
enableBody: function (reset, x, y, enableGameObject, showGameObject)
{
this.body.enable = true;
if (reset)
{
this.body.reset(x, y);
@ -45,6 +43,8 @@ var Enable = {
this.body.gameObject.visible = true;
}
this.body.enable = true;
return this;
},
@ -54,10 +54,10 @@ var Enable = {
* @method Phaser.Physics.Arcade.Components.Enable#disableBody
* @since 3.0.0
*
* @param {[type]} disableGameObject - [description]
* @param {[type]} hideGameObject - [description]
* @param {boolean} [disableGameObject=false] - [description]
* @param {boolean} [hideGameObject=false] - [description]
*
* @return {[type]} [description]
* @return {Phaser.GameObjects.GameObject} This Game Object.
*/
disableBody: function (disableGameObject, hideGameObject)
{
@ -78,6 +78,24 @@ var Enable = {
this.body.gameObject.visible = false;
}
return this;
},
/**
* Syncs the Bodies position and size with its parent Game Object.
* You don't need to call this for Dynamic Bodies, as it happens automatically.
* But for Static bodies it's a useful way of modifying the position of a Static Body
* in the Physics World, based on its Game Object.
*
* @method Phaser.Physics.Arcade.Components.Enable#refreshBody
* @since 3.0.1
*
* @return {Phaser.GameObjects.GameObject} This Game Object.
*/
refreshBody: function ()
{
this.body.updateFromGameObject();
return this;
}