77*
88* Phaser - http://phaser.io
99*
10- * v2.4.8 "Watch Hill " - Built: Thu May 19 2016 12:22:29
10+ * v2.4.9 "Four Kings " - Built: Mon May 23 2016 13:17:39
1111*
1212* By Richard Davey http://www.photonstorm.com @photonstorm
1313*
@@ -635,7 +635,7 @@ PIXI.DisplayObject.prototype.updateTransform = function(parent)
635635 this.worldAlpha = this.alpha * p.worldAlpha;
636636
637637 this.worldPosition.set(wt.tx, wt.ty);
638- this.worldScale.set(wt.a, wt.d );
638+ this.worldScale.set(Math.sqrt( wt.a * wt.a + wt.b * wt.b), Math.sqrt( wt.c * wt.c + wt.d * wt.d) );
639639 this.worldRotation = Math.atan2(wt.c, wt.d);
640640
641641 // reset the bounds each time this is called!
@@ -9157,7 +9157,7 @@ var Phaser = Phaser || {
91579157 * @constant
91589158 * @type {string}
91599159 */
9160- VERSION: '2.4.8 ',
9160+ VERSION: '2.4.9-dev ',
91619161
91629162 /**
91639163 * An array of Phaser game instances.
@@ -26948,7 +26948,7 @@ Phaser.InputHandler.prototype = {
2694826948 !this.sprite ||
2694926949 !this.sprite.parent ||
2695026950 !this.sprite.visible ||
26951- !this.sprite.parent.visible |
26951+ !this.sprite.parent.visible ||
2695226952 this.sprite.worldScale.x === 0 ||
2695326953 this.sprite.worldScale.y === 0)
2695426954 {
@@ -26988,19 +26988,17 @@ Phaser.InputHandler.prototype = {
2698826988 */
2698926989 checkPointerOver: function (pointer, fastTest) {
2699026990
26991- if (!pointer.isDown ||
26992- !this.enabled ||
26991+ if (!this.enabled ||
2699326992 !this.sprite ||
2699426993 !this.sprite.parent ||
2699526994 !this.sprite.visible ||
26996- !this.sprite.parent.visible |
26995+ !this.sprite.parent.visible ||
2699726996 this.sprite.worldScale.x === 0 ||
2699826997 this.sprite.worldScale.y === 0)
2699926998 {
2700026999 return false;
2700127000 }
2700227001
27003-
2700427002 // Need to pass it a temp point, in case we need it again for the pixel check
2700527003 if (this.game.input.hitTest(this.sprite, pointer, this._tempPoint))
2700627004 {
@@ -71114,8 +71112,11 @@ Phaser.Physics.Arcade.Body.prototype = {
7111471112
7111571113 this.updateBounds();
7111671114
71117- this.position.x = (this.sprite.world.x - (this.sprite.anchor.x * this.sprite.width)) + this.offset.x;
71118- this.position.y = (this.sprite.world.y - (this.sprite.anchor.y * this.sprite.height)) + this.offset.y;
71115+ this.position.x = (this.sprite.world.x - (this.sprite.anchor.x * this.sprite.width)) + this.sprite.scale.x * this.offset.x;
71116+ this.position.x -= this.sprite.scale.x < 0 ? this.width : 0;
71117+
71118+ this.position.y = (this.sprite.world.y - (this.sprite.anchor.y * this.sprite.height)) + this.sprite.scale.y * this.offset.y;
71119+ this.position.y -= this.sprite.scale.y < 0 ? this.height : 0;
7111971120
7112071121 this.rotation = this.sprite.angle;
7112171122
@@ -71284,17 +71285,24 @@ Phaser.Physics.Arcade.Body.prototype = {
7128471285
7128571286 /**
7128671287 * You can modify the size of the physics Body to be any dimension you need.
71287- * So it could be smaller or larger than the parent Sprite. You can also control the x and y offset, which
71288- * is the position of the Body relative to the top-left of the Sprite.
71288+ * This allows you to make it smaller, or larger, than the parent Sprite.
71289+ * You can also control the x and y offset of the Body. This is the position of the
71290+ * Body relative to the top-left of the Sprite _texture_.
7128971291 *
71290- * Calling `setSize` will have no effect if you have previously used `Body.setCircle`. To change a collision
71291- * circle use `setCircle` instead.
71292+ * For example: If you have a Sprite with a texture that is 80x100 in size,
71293+ * and you want the physics body to be 32x32 pixels in the middle of the texture, you would do:
71294+ *
71295+ * `setSize(32, 32, 24, 34)`
71296+ *
71297+ * Where the first two parameters is the new Body size (32x32 pixels).
71298+ * 24 is the horizontal offset of the Body from the top-left of the Sprites texture, and 34
71299+ * is the vertical offset.
7129271300 *
7129371301 * @method Phaser.Physics.Arcade.Body#setSize
7129471302 * @param {number} width - The width of the Body.
7129571303 * @param {number} height - The height of the Body.
71296- * @param {number} [offsetX] - The X offset of the Body from the Sprite position .
71297- * @param {number} [offsetY] - The Y offset of the Body from the Sprite position .
71304+ * @param {number} [offsetX] - The X offset of the Body from the top-left of the Sprites texture .
71305+ * @param {number} [offsetY] - The Y offset of the Body from the top-left of the Sprites texture .
7129871306 */
7129971307 setSize: function (width, height, offsetX, offsetY) {
7130071308
@@ -71318,47 +71326,6 @@ Phaser.Physics.Arcade.Body.prototype = {
7131871326
7131971327 },
7132071328
71321- /**
71322- * Sets this Body as using a circle, of the given radius, for all collision detection instead of a rectangle.
71323- * The radius is given in pixels and is the distance from the center of the circle to the edge.
71324- *
71325- * You can also control the x and y offset, which is the position of the Body relative to the top-left of the Sprite.
71326- *
71327- * @method Phaser.Physics.Arcade.Body#setCircle
71328- * @param {number} [radius] - The radius of the Body in pixels. Pass a value of zero / undefined, to stop the Body using a circle for collision.
71329- * @param {number} [offsetX] - The X offset of the Body from the Sprite position.
71330- * @param {number} [offsetY] - The Y offset of the Body from the Sprite position.
71331- */
71332- setCircle: function (radius, offsetX, offsetY) {
71333-
71334- if (offsetX === undefined) { offsetX = this.offset.x; }
71335- if (offsetY === undefined) { offsetY = this.offset.y; }
71336-
71337- if (radius > 0)
71338- {
71339- this.isCircle = true;
71340- this.radius = radius;
71341-
71342- this.sourceWidth = radius * 2;
71343- this.sourceHeight = radius * 2;
71344-
71345- this.width = this.sourceWidth * this._sx;
71346- this.height = this.sourceHeight * this._sy;
71347-
71348- this.halfWidth = Math.floor(this.width / 2);
71349- this.halfHeight = Math.floor(this.height / 2);
71350-
71351- this.offset.setTo(offsetX, offsetY);
71352-
71353- this.center.setTo(this.position.x + this.halfWidth, this.position.y + this.halfHeight);
71354- }
71355- else
71356- {
71357- this.isCircle = false;
71358- }
71359-
71360- },
71361-
7136271329 /**
7136371330 * Resets all Body values (velocity, acceleration, rotation, etc)
7136471331 *
@@ -71375,8 +71342,11 @@ Phaser.Physics.Arcade.Body.prototype = {
7137571342 this.angularVelocity = 0;
7137671343 this.angularAcceleration = 0;
7137771344
71378- this.position.x = (x - (this.sprite.anchor.x * this.sprite.width)) + this.offset.x;
71379- this.position.y = (y - (this.sprite.anchor.y * this.sprite.height)) + this.offset.y;
71345+ this.position.x = (x - (this.sprite.anchor.x * this.sprite.width)) + this.sprite.scale.x * this.offset.x;
71346+ this.position.x -= this.sprite.scale.x < 0 ? this.width : 0;
71347+
71348+ this.position.y = (y - (this.sprite.anchor.y * this.sprite.height)) + this.sprite.scale.y * this.offset.y;
71349+ this.position.y -= this.sprite.scale.y < 0 ? this.height : 0;
7138071350
7138171351 this.prev.x = this.position.x;
7138271352 this.prev.y = this.position.y;
0 commit comments