Added missing JSDocs

This commit is contained in:
Richard Davey 2020-01-08 12:15:29 +00:00
parent 2859eb6a68
commit ae8bfbc013
2 changed files with 41 additions and 23 deletions

View file

@ -104,8 +104,8 @@ var Factory = new Class({
*
* @param {number} x - The X coordinate of the center of the Body.
* @param {number} y - The Y coordinate of the center of the Body.
* @param {number} width - The width of the trapezoid of the Body.
* @param {number} height - The height of the trapezoid of the Body.
* @param {number} width - The width of the trapezoid Body.
* @param {number} height - The height of the trapezoid Body.
* @param {number} slope - The slope of the trapezoid. 0 creates a rectangle, while 1 creates a triangle. Positive values make the top side shorter, while negative values make the bottom side shorter.
* @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation.
*

View file

@ -11,24 +11,25 @@ var PhysicsEditorParser = require('../PhysicsEditorParser');
var Vertices = require('../lib/geometry/Vertices');
/**
* [description]
* Enables a Matter-enabled Game Object to set its Body. Should be used as a mixin and not directly.
*
* @namespace Phaser.Physics.Matter.Components.SetBody
* @since 3.0.0
*/
var SetBody = {
// Calling any of these methods resets previous properties you may have set on the body, including plugins, mass, etc
/**
* Set the body on a Game Object to a rectangle.
*
* Calling this methods resets previous properties you may have set on the body, including
* plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed.
*
* @method Phaser.Physics.Matter.Components.SetBody#setRectangle
* @since 3.0.0
*
* @param {number} width - Width of the rectangle.
* @param {number} height - Height of the rectangle.
* @param {object} options - [description]
* @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation.
*
* @return {Phaser.GameObjects.GameObject} This Game Object.
*/
@ -38,13 +39,16 @@ var SetBody = {
},
/**
* [description]
* Set the body on a Game Object to a circle.
*
* Calling this methods resets previous properties you may have set on the body, including
* plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed.
*
* @method Phaser.Physics.Matter.Components.SetBody#setCircle
* @since 3.0.0
*
* @param {number} radius - [description]
* @param {object} options - [description]
* @param {number} radius - The radius of the circle.
* @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation.
*
* @return {Phaser.GameObjects.GameObject} This Game Object.
*/
@ -55,13 +59,16 @@ var SetBody = {
/**
* Set the body on the Game Object to a polygon shape.
*
* Calling this methods resets previous properties you may have set on the body, including
* plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed.
*
* @method Phaser.Physics.Matter.Components.SetBody#setPolygon
* @since 3.0.0
*
* @param {number} radius - The radius of the polygon.
* @param {number} sides - The amount of sides creating the polygon.
* @param {object} options - A matterjs config object.
* @param {number} sides - The number of sides the polygon will have.
* @param {number} radius - The "radius" of the polygon, i.e. the distance from its center to any vertex. This is also the radius of its circumcircle.
* @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation.
*
* @return {Phaser.GameObjects.GameObject} This Game Object.
*/
@ -71,15 +78,18 @@ var SetBody = {
},
/**
* Creates a new matterjs trapezoid body.
* Set the body on the Game Object to a trapezoid shape.
*
* Calling this methods resets previous properties you may have set on the body, including
* plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed.
*
* @method Phaser.Physics.Matter.Components.SetBody#setTrapezoid
* @since 3.0.0
*
* @param {number} width - The width of the trapezoid.
* @param {number} height - The height of the trapezoid.
* @param {number} slope - The angle of slope for the trapezoid.
* @param {object} options - A matterjs config object for the body.
* @param {number} width - The width of the trapezoid Body.
* @param {number} height - The height of the trapezoid Body.
* @param {number} slope - The slope of the trapezoid. 0 creates a rectangle, while 1 creates a triangle. Positive values make the top side shorter, while negative values make the bottom side shorter.
* @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation.
*
* @return {Phaser.GameObjects.GameObject} This Game Object.
*/
@ -89,13 +99,18 @@ var SetBody = {
},
/**
* [description]
* Set this Game Object to use the given existing Matter Body.
*
* The body is first removed from the world before being added to this Game Object.
*
* Calling this methods resets previous properties you may have set on the body, including
* plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed.
*
* @method Phaser.Physics.Matter.Components.SetBody#setExistingBody
* @since 3.0.0
*
* @param {MatterJS.Body} body - [description]
* @param {boolean} [addToWorld=true] - Should the newly created body be immediately added to the World?
* @param {MatterJS.Body} body - The Body this Game Object should use.
* @param {boolean} [addToWorld=true] - Should the body be immediately added to the World?
*
* @return {Phaser.GameObjects.GameObject} This Game Object.
*/
@ -144,13 +159,16 @@ var SetBody = {
},
/**
* [description]
* Set this Game Object to create and use a new Body based on the configuration object given.
*
* Calling this methods resets previous properties you may have set on the body, including
* plugins, mass, friction, etc. So be sure to re-apply these in the options object if needed.
*
* @method Phaser.Physics.Matter.Components.SetBody#setBody
* @since 3.0.0
*
* @param {object} config - [description]
* @param {object} options - [description]
* @param {(string|Phaser.Types.Physics.Matter.MatterSetBodyConfig)} config - Either a string, such as `circle`, or a Matter Set Body Configuration object.
* @param {Phaser.Types.Physics.Matter.MatterBodyConfig} [options] - An optional Body configuration object that is used to set initial Body properties on creation.
*
* @return {Phaser.GameObjects.GameObject} This Game Object.
*/