ArcadePhysics.Body.setSize if you set offset x/y values previously and then passed zero values they would be ignored (thanks @casensiom fix #889)

This commit is contained in:
photonstorm 2014-06-11 00:21:04 +01:00
parent e923e230e0
commit 50e47d89ee
3 changed files with 6 additions and 5 deletions

View file

@ -120,6 +120,7 @@ Version 2.0.6 - "Jornhill" - -in development-
* When creating a Sprite or Image using a texture atlas it would set the frame twice, once in loadTexture and once when the initial frame is set. This has been reduced down to just a single setting now.
* BitmapData.getPixel fix for pixels with zero red value (thanks @lstor fix #894)
* If you call ArcadePhysics.collide on a Sprite vs. a Tilemap and provide a custom processCallback, the result was being ignored and the sprite was being separated regardless (thanks @aivins fix #891 #890)
* ArcadePhysics.Body.setSize if you set offset x/y values previously and then passed zero values they would be ignored (thanks @casensiom fix #889)
### Migration Guide

2
build/phaser.d.ts vendored
View file

@ -3107,7 +3107,7 @@ declare module Phaser {
render(context: Object, body: Phaser.Physics.Arcade.Body, filled?: boolean, color?: string): void;
renderBodyInfo(debug: Phaser.Utils.Debug, body: Phaser.Physics.Arcade.Body): void;
reset(x: number, y: number): void;
setSize(width: number, height: number, offsetX: number, offsetY: number): void;
setSize(width: number, height: number, offsetX?: number, offsetY?: number): void;
updateBounds(): boolean;
}

View file

@ -566,13 +566,13 @@ Phaser.Physics.Arcade.Body.prototype = {
* @method Phaser.Physics.Arcade.Body#setSize
* @param {number} width - The width of the Body.
* @param {number} height - The height of the Body.
* @param {number} offsetX - The X offset of the Body from the Sprite position.
* @param {number} offsetY - The Y offset of the Body from the Sprite position.
* @param {number} [offsetX] - The X offset of the Body from the Sprite position.
* @param {number} [offsetY] - The Y offset of the Body from the Sprite position.
*/
setSize: function (width, height, offsetX, offsetY) {
offsetX = offsetX || this.offset.x;
offsetY = offsetY || this.offset.y;
if (typeof offsetX === 'undefined') { offsetX = this.offset.x; }
if (typeof offsetY === 'undefined') { offsetY = this.offset.y; }
this.sourceWidth = width;
this.sourceHeight = height;