Skip to content

Commit a312d03

Browse files
committed
Docs for Phaser.Physics.Arcade.StaticBody
`offset` is read only
1 parent c07c57f commit a312d03

1 file changed

Lines changed: 18 additions & 16 deletions

File tree

src/physics/arcade/StaticBody.js

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ var Vector2 = require('../../math/Vector2');
1515
* A Static Arcade Physics Body.
1616
*
1717
* A Static Body never moves, and isn't automatically synchronized with its parent Game Object.
18-
* That means if you make any change to the parent's origin, position, or scale after creating or adding the body, you'll need to update the Body manually.
18+
* That means if you make any change to the parent's origin, position, or scale after creating or adding the body, you'll need to update the Static Body manually.
1919
*
2020
* A Static Body can collide with other Bodies, but is never moved by collisions.
2121
*
@@ -95,8 +95,8 @@ var StaticBody = new Class({
9595
this.isCircle = false;
9696

9797
/**
98-
* If this Static Body is circular, this is the unscaled radius of the Static Body's boundary, as set by {@link #setCircle}, in source pixels.
99-
* The true radius is equal to `halfWidth`.
98+
* If this Static Body is circular, this is the radius of the boundary, as set by {@link Phaser.Physics.Arcade.StaticBody#setCircle}, in pixels.
99+
* Equal to `halfWidth`.
100100
*
101101
* @name Phaser.Physics.Arcade.StaticBody#radius
102102
* @type {number}
@@ -106,12 +106,13 @@ var StaticBody = new Class({
106106
this.radius = 0;
107107

108108
/**
109-
* The offset of this Static Body's actual position from any updated position.
109+
* The offset set by {@link Phaser.Physics.Arcade.StaticBody#setCircle} or {@link Phaser.Physics.Arcade.StaticBody#setSize}.
110110
*
111-
* Unlike a dynamic Body, a Static Body does not follow its Game Object. As such, this offset is only applied when resizing the Static Body.
111+
* This doesn't affect the Static Body's position, because a Static Body does not follow its Game Object.
112112
*
113113
* @name Phaser.Physics.Arcade.StaticBody#offset
114114
* @type {Phaser.Math.Vector2}
115+
* @readonly
115116
* @since 3.0.0
116117
*/
117118
this.offset = new Vector2();
@@ -389,7 +390,7 @@ var StaticBody = new Class({
389390
this.physicsType = CONST.STATIC_BODY;
390391

391392
/**
392-
* The calculated change in the Body's horizontal position during the current step.
393+
* The calculated change in the Static Body's horizontal position during the current step.
393394
* For a static body this is always zero.
394395
*
395396
* @name Phaser.Physics.Arcade.StaticBody#_dx
@@ -401,7 +402,7 @@ var StaticBody = new Class({
401402
this._dx = 0;
402403

403404
/**
404-
* The calculated change in the Body's vertical position during the current step.
405+
* The calculated change in the Static Body's vertical position during the current step.
405406
* For a static body this is always zero.
406407
*
407408
* @name Phaser.Physics.Arcade.StaticBody#_dy
@@ -450,7 +451,7 @@ var StaticBody = new Class({
450451
},
451452

452453
/**
453-
* Syncs the Body's position and size with its parent Game Object.
454+
* Syncs the Static Body's position and size with its parent Game Object.
454455
*
455456
* @method Phaser.Physics.Arcade.StaticBody#updateFromGameObject
456457
* @since 3.1.0
@@ -479,13 +480,13 @@ var StaticBody = new Class({
479480
},
480481

481482
/**
482-
* Sets the offset of the body.
483+
* Positions the Static Body at an offset from its Game Object.
483484
*
484485
* @method Phaser.Physics.Arcade.StaticBody#setOffset
485486
* @since 3.4.0
486487
*
487-
* @param {number} x - The horizontal offset of the Body from the Game Object's center.
488-
* @param {number} y - The vertical offset of the Body from the Game Object's center.
488+
* @param {number} x - The horizontal offset of the Static Body from the Game Object's `x`.
489+
* @param {number} y - The vertical offset of the Static Body from the Game Object's `y`.
489490
*
490491
* @return {Phaser.Physics.Arcade.StaticBody} This Static Body object.
491492
*/
@@ -511,15 +512,16 @@ var StaticBody = new Class({
511512
},
512513

513514
/**
514-
* Sets the size of the body.
515+
* Sets the size of the Static Body.
516+
* When `center` is true, also repositions it.
515517
* Resets the width and height to match current frame, if no width and height provided and a frame is found.
516518
*
517519
* @method Phaser.Physics.Arcade.StaticBody#setSize
518520
* @since 3.0.0
519521
*
520-
* @param {integer} [width] - The width of the Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame width.
521-
* @param {integer} [height] - The height of the Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame height.
522-
* @param {boolean} [center=true] - Modify the Body's `offset`, placing the Body's center on its Game Object's center. Only works if the Game Object has the `getCenter` method.
522+
* @param {integer} [width] - The width of the Static Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame width.
523+
* @param {integer} [height] - The height of the Static Body in pixels. Cannot be zero. If not given, and the parent Game Object has a frame, it will use the frame height.
524+
* @param {boolean} [center=true] - Place the Static Body's center on its Game Object's center. Only works if the Game Object has the `getCenter` method.
523525
*
524526
* @return {Phaser.Physics.Arcade.StaticBody} This Static Body object.
525527
*/
@@ -572,7 +574,7 @@ var StaticBody = new Class({
572574
},
573575

574576
/**
575-
* Sets this Static Body to have a circular body and sets its sizes and position.
577+
* Sets this Static Body to have a circular body and sets its size and position.
576578
*
577579
* @method Phaser.Physics.Arcade.StaticBody#setCircle
578580
* @since 3.0.0

0 commit comments

Comments
 (0)