Velocity integration tidied up. Now moving to sync Body with Sprite center point.

This commit is contained in:
photonstorm
2014-01-28 01:29:35 +00:00
parent fbe508ab1b
commit 90c09374af
10 changed files with 291 additions and 316 deletions
+28 -1
View File
@@ -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.