mirror of
https://github.com/wassname/phaser.git
synced 2026-07-07 00:06:37 +08:00
Velocity integration tidied up. Now moving to sync Body with Sprite center point.
This commit is contained in:
@@ -507,7 +507,6 @@ Phaser.Sprite.prototype.updateAnimation = function() {
|
||||
this._cache.halfHeight = Math.floor(this._cache.height / 2);
|
||||
|
||||
this._cache.dirty = true;
|
||||
|
||||
}
|
||||
|
||||
};
|
||||
@@ -993,6 +992,34 @@ Phaser.Sprite.prototype.play = function (name, frameRate, loop, killOnComplete)
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* Returns the delta x value. The difference between Sprite.x now and in the previous step.
|
||||
* @name Phaser.Sprite#deltaX
|
||||
* @property {number} deltaX - The delta value. Positive if the motion was to the right, negative if to the left.
|
||||
* @readonly
|
||||
*/
|
||||
Object.defineProperty(Phaser.Sprite.prototype, 'deltaX', {
|
||||
|
||||
get: function() {
|
||||
return this.world.x - this._cache.prevX;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* Returns the delta x value. The difference between Sprite.y now and in the previous step.
|
||||
* @name Phaser.Sprite#deltaY
|
||||
* @property {number} deltaY - The delta value. Positive if the motion was downwards, negative if upwards.
|
||||
* @readonly
|
||||
*/
|
||||
Object.defineProperty(Phaser.Sprite.prototype, 'deltaY', {
|
||||
|
||||
get: function() {
|
||||
return this.world.y - this._cache.prevY;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
/**
|
||||
* Indicates the rotation of the Sprite, in degrees, from its original orientation. Values from 0 to 180 represent clockwise rotation; values from 0 to -180 represent counterclockwise rotation.
|
||||
* Values outside this range are added to or subtracted from 360 to obtain a value within the range. For example, the statement player.angle = 450 is the same as player.angle = 90.
|
||||
|
||||
Reference in New Issue
Block a user