mirror of
https://github.com/photonstorm/phaser
synced 2024-11-17 10:18:42 +00:00
Docs for Arcade Physics
Minor additions/corrections
This commit is contained in:
parent
83e2de2baf
commit
b5a2d9d0cf
9 changed files with 34 additions and 33 deletions
|
@ -10,12 +10,10 @@ var Image = require('../../gameobjects/image/Image');
|
|||
|
||||
/**
|
||||
* @classdesc
|
||||
* An Arcade Physics Image Game Object.
|
||||
* An Arcade Physics Image is an Image with an Arcade Physics body and related components.
|
||||
* The body can be dynamic or static.
|
||||
*
|
||||
* An Image is a light-weight Game Object useful for the display of static images in your game,
|
||||
* such as logos, backgrounds, scenery or other non-animated elements. Images can have input
|
||||
* events and physics bodies, or be tweened, tinted or scrolled. The main difference between an
|
||||
* Image and a Sprite is that you cannot animate an Image as they do not have the Animation component.
|
||||
* The main difference between an Arcade Image and an Arcade Sprite is that you cannot animate an Arcade Image.
|
||||
*
|
||||
* @class Image
|
||||
* @extends Phaser.GameObjects.Image
|
||||
|
|
|
@ -10,15 +10,11 @@ var Sprite = require('../../gameobjects/sprite/Sprite');
|
|||
|
||||
/**
|
||||
* @classdesc
|
||||
* An Arcade Physics Sprite Game Object.
|
||||
* An Arcade Physics Sprite is a Sprite with an Arcade Physics body and related components.
|
||||
* The body can be dynamic or static.
|
||||
*
|
||||
* A Sprite Game Object is used for the display of both static and animated images in your game.
|
||||
* Sprites can have input events and physics bodies. They can also be tweened, tinted, scrolled
|
||||
* and animated.
|
||||
*
|
||||
* The main difference between a Sprite and an Image Game Object is that you cannot animate Images.
|
||||
* As such, Sprites take a fraction longer to process and have a larger API footprint due to the Animation
|
||||
* Component. If you do not require animation then you can safely use Images to replace Sprites in all cases.
|
||||
* The main difference between an Arcade Sprite and an Arcade Image is that you cannot animate an Arcade Image.
|
||||
* If you do not require animation then you can safely use Arcade Images instead of Arcade Sprites.
|
||||
*
|
||||
* @class Sprite
|
||||
* @extends Phaser.GameObjects.Sprite
|
||||
|
|
|
@ -623,7 +623,7 @@ var Body = new Class({
|
|||
this.overlapR = 0;
|
||||
|
||||
/**
|
||||
* Whether this Body is overlapped with another and both have zero velocity.
|
||||
* Whether this Body is overlapped with another and both are not moving.
|
||||
*
|
||||
* @name Phaser.Physics.Arcade.Body#embedded
|
||||
* @type {boolean}
|
||||
|
@ -718,6 +718,7 @@ var Body = new Class({
|
|||
* @name Phaser.Physics.Arcade.Body#physicsType
|
||||
* @type {integer}
|
||||
* @readonly
|
||||
* @default Phaser.Physics.Arcade.DYNAMIC_BODY
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.physicsType = CONST.DYNAMIC_BODY;
|
||||
|
@ -787,7 +788,8 @@ var Body = new Class({
|
|||
},
|
||||
|
||||
/**
|
||||
* Updates this Body's transform, dimensions, and position from its Game Object.
|
||||
* Updates the Body's `transform`, `width`, `height`, and `center` from its Game Object.
|
||||
* The Body's `position` isn't changed.
|
||||
*
|
||||
* @method Phaser.Physics.Arcade.Body#updateBounds
|
||||
* @since 3.0.0
|
||||
|
@ -874,7 +876,7 @@ var Body = new Class({
|
|||
* @fires Phaser.Physics.Arcade.World#worldbounds
|
||||
* @since 3.0.0
|
||||
*
|
||||
* @param {number} delta - The delta time, in ms, elapsed since the last frame.
|
||||
* @param {number} delta - The delta time, in seconds, elapsed since the last frame.
|
||||
*/
|
||||
update: function (delta)
|
||||
{
|
||||
|
|
|
@ -40,7 +40,7 @@ var Collider = new Class({
|
|||
this.world = world;
|
||||
|
||||
/**
|
||||
* The name of the collider (unused by phaser).
|
||||
* The name of the collider (unused by Phaser).
|
||||
*
|
||||
* @name Phaser.Physics.Arcade.Collider#name
|
||||
* @type {string}
|
||||
|
|
|
@ -58,7 +58,7 @@ var Factory = new Class({
|
|||
},
|
||||
|
||||
/**
|
||||
* Create a new Arcade Physics Collider object.
|
||||
* Creates a new Arcade Physics Collider object.
|
||||
*
|
||||
* @method Phaser.Physics.Arcade.Factory#collider
|
||||
* @since 3.0.0
|
||||
|
@ -77,7 +77,7 @@ var Factory = new Class({
|
|||
},
|
||||
|
||||
/**
|
||||
* Create a new Arcade Physics Collider Overlap object.
|
||||
* Creates a new Arcade Physics Collider Overlap object.
|
||||
*
|
||||
* @method Phaser.Physics.Arcade.Factory#overlap
|
||||
* @since 3.0.0
|
||||
|
|
|
@ -154,7 +154,7 @@ var PhysicsGroup = new Class({
|
|||
*
|
||||
* @name Phaser.Physics.Arcade.Group#physicsType
|
||||
* @type {integer}
|
||||
* @default DYNAMIC_BODY
|
||||
* @default Phaser.Physics.Arcade.DYNAMIC_BODY
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.physicsType = CONST.DYNAMIC_BODY;
|
||||
|
|
|
@ -219,10 +219,12 @@ var StaticBody = new Class({
|
|||
// If true this Body will dispatch events
|
||||
|
||||
/**
|
||||
* Whether the simulation emits a `worldbounds` event when this StaticBody collides with the world boundary (and `collideWorldBounds` is also true).
|
||||
* Whether the simulation emits a `worldbounds` event when this StaticBody collides with the world boundary.
|
||||
* Always false for a Static Body. (Static Bodies never collide with the world boundary and never trigger a `worldbounds` event.)
|
||||
*
|
||||
* @name Phaser.Physics.Arcade.StaticBody#onWorldBounds
|
||||
* @type {boolean}
|
||||
* @readonly
|
||||
* @default false
|
||||
* @since 3.0.0
|
||||
*/
|
||||
|
@ -269,7 +271,7 @@ var StaticBody = new Class({
|
|||
this.immovable = true;
|
||||
|
||||
/**
|
||||
* A flag disabling the default horizontal separation of colliding bodies. Pass your own `processHandler` to the collider.
|
||||
* A flag disabling the default horizontal separation of colliding bodies. Pass your own `collideHandler` to the collider.
|
||||
*
|
||||
* @name Phaser.Physics.Arcade.StaticBody#customSeparateX
|
||||
* @type {boolean}
|
||||
|
@ -279,7 +281,7 @@ var StaticBody = new Class({
|
|||
this.customSeparateX = false;
|
||||
|
||||
/**
|
||||
* A flag disabling the default vertical separation of colliding bodies. Pass your own `processHandler` to the collider.
|
||||
* A flag disabling the default vertical separation of colliding bodies. Pass your own `collideHandler` to the collider.
|
||||
*
|
||||
* @name Phaser.Physics.Arcade.StaticBody#customSeparateY
|
||||
* @type {boolean}
|
||||
|
@ -319,7 +321,7 @@ var StaticBody = new Class({
|
|||
this.overlapR = 0;
|
||||
|
||||
/**
|
||||
* Whether this StaticBody is overlapped with another and both have zero velocity.
|
||||
* Whether this StaticBody has ever overlapped with another while both were not moving.
|
||||
*
|
||||
* @name Phaser.Physics.Arcade.StaticBody#embedded
|
||||
* @type {boolean}
|
||||
|
@ -330,9 +332,11 @@ var StaticBody = new Class({
|
|||
|
||||
/**
|
||||
* Whether this StaticBody interacts with the world boundary.
|
||||
* Always false for a Static Body. (Static Bodies never collide with the world boundary.)
|
||||
*
|
||||
* @name Phaser.Physics.Arcade.StaticBody#collideWorldBounds
|
||||
* @type {boolean}
|
||||
* @readonly
|
||||
* @default false
|
||||
* @since 3.0.0
|
||||
*/
|
||||
|
@ -348,7 +352,7 @@ var StaticBody = new Class({
|
|||
this.checkCollision = { none: false, up: true, down: true, left: true, right: true };
|
||||
|
||||
/**
|
||||
* Whether this StaticBody is colliding with another and in which direction.
|
||||
* Whether this StaticBody has ever collided with another body and in which direction.
|
||||
*
|
||||
* @name Phaser.Physics.Arcade.StaticBody#touching
|
||||
* @type {ArcadeBodyCollision}
|
||||
|
@ -357,7 +361,7 @@ var StaticBody = new Class({
|
|||
this.touching = { none: true, up: false, down: false, left: false, right: false };
|
||||
|
||||
/**
|
||||
* Whether this StaticBody was colliding with another during the last step, and in which direction.
|
||||
* Whether this StaticBody was colliding with another body during the last step or any previous step, and in which direction.
|
||||
*
|
||||
* @name Phaser.Physics.Arcade.StaticBody#wasTouching
|
||||
* @type {ArcadeBodyCollision}
|
||||
|
@ -366,7 +370,7 @@ var StaticBody = new Class({
|
|||
this.wasTouching = { none: true, up: false, down: false, left: false, right: false };
|
||||
|
||||
/**
|
||||
* Whether this StaticBody is colliding with a tile or the world boundary.
|
||||
* Whether this StaticBody has ever collided with a tile or the world boundary.
|
||||
*
|
||||
* @name Phaser.Physics.Arcade.StaticBody#blocked
|
||||
* @type {ArcadeBodyCollision}
|
||||
|
@ -379,6 +383,7 @@ var StaticBody = new Class({
|
|||
*
|
||||
* @name Phaser.Physics.Arcade.StaticBody#physicsType
|
||||
* @type {integer}
|
||||
* @default Phaser.Physics.Arcade.STATIC_BODY
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.physicsType = CONST.STATIC_BODY;
|
||||
|
|
|
@ -86,7 +86,7 @@ var StaticPhysicsGroup = new Class({
|
|||
*
|
||||
* @name Phaser.Physics.Arcade.StaticGroup#physicsType
|
||||
* @type {integer}
|
||||
* @default STATIC_BODY
|
||||
* @default Phaser.Physics.Arcade.STATIC_BODY
|
||||
* @since 3.0.0
|
||||
*/
|
||||
this.physicsType = CONST.STATIC_BODY;
|
||||
|
|
|
@ -1046,12 +1046,12 @@ var World = new Class({
|
|||
},
|
||||
|
||||
/**
|
||||
* Advances the simulation by one step.
|
||||
* Advances the simulation by a time increment.
|
||||
*
|
||||
* @method Phaser.Physics.Arcade.World#step
|
||||
* @since 3.10.0
|
||||
*
|
||||
* @param {number} delta - The delta time amount, in ms, by which to advance the simulation.
|
||||
* @param {number} delta - The delta time amount, in seconds, by which to advance the simulation.
|
||||
*/
|
||||
step: function (delta)
|
||||
{
|
||||
|
@ -1190,7 +1190,7 @@ var World = new Class({
|
|||
* @since 3.0.0
|
||||
*
|
||||
* @param {Phaser.Physics.Arcade.Body} body - The Body to be updated.
|
||||
* @param {number} delta - The delta value to be used in the motion calculations.
|
||||
* @param {number} delta - The delta value to be used in the motion calculations, in seconds.
|
||||
*/
|
||||
updateMotion: function (body, delta)
|
||||
{
|
||||
|
@ -1209,7 +1209,7 @@ var World = new Class({
|
|||
* @since 3.10.0
|
||||
*
|
||||
* @param {Phaser.Physics.Arcade.Body} body - The Body to compute the velocity for.
|
||||
* @param {number} delta - The delta value to be used in the calculation.
|
||||
* @param {number} delta - The delta value to be used in the calculation, in seconds.
|
||||
*/
|
||||
computeAngularVelocity: function (body, delta)
|
||||
{
|
||||
|
@ -1255,7 +1255,7 @@ var World = new Class({
|
|||
* @since 3.0.0
|
||||
*
|
||||
* @param {Phaser.Physics.Arcade.Body} body - The Body to compute the velocity for.
|
||||
* @param {number} delta - The delta value to be used in the calculation.
|
||||
* @param {number} delta - The delta value to be used in the calculation, in seconds.
|
||||
*/
|
||||
computeVelocity: function (body, delta)
|
||||
{
|
||||
|
|
Loading…
Reference in a new issue