mirror of
https://github.com/photonstorm/phaser
synced 2024-11-10 15:14:47 +00:00
Added deltaXFinal
and deltaYFinal
methods.
This commit is contained in:
parent
074c91c43a
commit
44ff20d07e
2 changed files with 79 additions and 2 deletions
|
@ -1,6 +1,6 @@
|
|||
# Change Log
|
||||
|
||||
## Version 3.21.1 - Senku - in development
|
||||
## Version 3.22 - Senku - in development
|
||||
|
||||
### Matter Physics Updates
|
||||
|
||||
|
@ -91,6 +91,10 @@
|
|||
|
||||
### Updates
|
||||
|
||||
* `Body.deltaXFinal` is a new method on Arcade Physics Bodies that will return the final change in the horizontal position of the body, as based on all the steps that took place this frame. This property is calculated during the `postUpdate` phase, so must be listened for accordingly (thanks Bambosh)
|
||||
* `Body.deltaYFinal` is a new method on Arcade Physics Bodies that will return the final change in the vertical position of the body, as based on all the steps that took place this frame. This property is calculated during the `postUpdate` phase, so must be listened for accordingly (thanks Bambosh)
|
||||
* `Body._tx` is a new internal private var, holding the Arcade Physics Body combined total delta x value.
|
||||
* `Body._ty` is a new internal private var, holding the Arcade Physics Body combined total delta y value.
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
@ -100,7 +104,7 @@
|
|||
|
||||
My thanks to the following for helping with the Phaser 3 Examples, Docs and TypeScript definitions, either by reporting errors, fixing them or helping author the docs:
|
||||
|
||||
@fselcukcan
|
||||
@fselcukcan Bambosh
|
||||
|
||||
|
||||
## Version 3.21.0 - Senku - 22nd November 2019
|
||||
|
|
|
@ -761,6 +761,28 @@ var Body = new Class({
|
|||
*/
|
||||
this._dy = 0;
|
||||
|
||||
/**
|
||||
* The calculated change in the Body's horizontal position during as of `postUpdate`.
|
||||
*
|
||||
* @name Phaser.Physics.Arcade.Body#_tx
|
||||
* @type {number}
|
||||
* @private
|
||||
* @default 0
|
||||
* @since 3.22.0
|
||||
*/
|
||||
this._tx = 0;
|
||||
|
||||
/**
|
||||
* The calculated change in the Body's vertical position during as of `postUpdate`.
|
||||
*
|
||||
* @name Phaser.Physics.Arcade.Body#_ty
|
||||
* @type {number}
|
||||
* @private
|
||||
* @default 0
|
||||
* @since 3.22.0
|
||||
*/
|
||||
this._ty = 0;
|
||||
|
||||
/**
|
||||
* Stores the Game Object's bounds.
|
||||
*
|
||||
|
@ -1050,6 +1072,9 @@ var Body = new Class({
|
|||
{
|
||||
this.gameObject.angle += this.deltaZ();
|
||||
}
|
||||
|
||||
this._tx = dx;
|
||||
this._ty = dy;
|
||||
},
|
||||
|
||||
/**
|
||||
|
@ -1423,6 +1448,9 @@ var Body = new Class({
|
|||
/**
|
||||
* The change in this Body's horizontal position from the previous step.
|
||||
* This value is set during the Body's update phase.
|
||||
*
|
||||
* As a Body can update multiple times per step this may not hold the final
|
||||
* delta value for the Body. In this case, please see the `deltaXFinal` method.
|
||||
*
|
||||
* @method Phaser.Physics.Arcade.Body#deltaX
|
||||
* @since 3.0.0
|
||||
|
@ -1437,6 +1465,9 @@ var Body = new Class({
|
|||
/**
|
||||
* The change in this Body's vertical position from the previous step.
|
||||
* This value is set during the Body's update phase.
|
||||
*
|
||||
* As a Body can update multiple times per step this may not hold the final
|
||||
* delta value for the Body. In this case, please see the `deltaYFinal` method.
|
||||
*
|
||||
* @method Phaser.Physics.Arcade.Body#deltaY
|
||||
* @since 3.0.0
|
||||
|
@ -1448,6 +1479,48 @@ var Body = new Class({
|
|||
return this._dy;
|
||||
},
|
||||
|
||||
/**
|
||||
* The change in this Body's horizontal position from the previous game update.
|
||||
*
|
||||
* This value is set during the `postUpdate` phase and takes into account the
|
||||
* `deltaMax` and final position of the Body.
|
||||
*
|
||||
* Because this value is not calculated until `postUpdate`, you must listen for it
|
||||
* during a Scene `POST_UPDATE` or `RENDER` event, and not in `update`, as it will
|
||||
* not be calculated by that point. If you _do_ use these values in `update` they
|
||||
* will represent the delta from the _previous_ game frame.
|
||||
*
|
||||
* @method Phaser.Physics.Arcade.Body#deltaXFinal
|
||||
* @since 3.22.0
|
||||
*
|
||||
* @return {number} The final delta x value.
|
||||
*/
|
||||
deltaXFinal: function ()
|
||||
{
|
||||
return this._tx;
|
||||
},
|
||||
|
||||
/**
|
||||
* The change in this Body's vertical position from the previous game update.
|
||||
*
|
||||
* This value is set during the `postUpdate` phase and takes into account the
|
||||
* `deltaMax` and final position of the Body.
|
||||
*
|
||||
* Because this value is not calculated until `postUpdate`, you must listen for it
|
||||
* during a Scene `POST_UPDATE` or `RENDER` event, and not in `update`, as it will
|
||||
* not be calculated by that point. If you _do_ use these values in `update` they
|
||||
* will represent the delta from the _previous_ game frame.
|
||||
*
|
||||
* @method Phaser.Physics.Arcade.Body#deltaYFinal
|
||||
* @since 3.22.0
|
||||
*
|
||||
* @return {number} The final delta y value.
|
||||
*/
|
||||
deltaYFinal: function ()
|
||||
{
|
||||
return this._ty;
|
||||
},
|
||||
|
||||
/**
|
||||
* The change in this Body's rotation from the previous step, in degrees.
|
||||
*
|
||||
|
|
Loading…
Reference in a new issue