Skip to content

Commit a7c3604

Browse files
committed
Tidying up code and docs.
1 parent 4574f31 commit a7c3604

2 files changed

Lines changed: 7 additions & 3 deletions

File tree

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -277,6 +277,7 @@ If you are an exceptional JavaScript developer and would like to join the Phaser
277277
* The Health Game Object component has a new method: `setHealth` which allows you to set the exact health amount. This is now used by the `revive` function.
278278
* Text.useAdvancedWrap allows you to swap between the Basic and the Advanced word wrapping functions. In Advanced it will wrap long-words and condense and trim excess white space (thanks @soldoutactivist #1811)
279279
* The Grunt script has been updated to enhance the intro / outro and Pixi defaults. Pixi has been split into intro / outro and main blocks, so you can exclude its intro cleanly. The excludes are now bound, so if you exclude the Phaser UMD it will do the same for Pixi as well (thanks @spayton #2192)
280+
* ArcadePhysics.worldAngleToPointer will get the angle (in radians) between a display object and the pointer, taking all parent rotations into account (thanks @mattrick16 #2171)
280281

281282
### Updates
282283

src/physics/arcade/World.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1699,20 +1699,23 @@ Phaser.Physics.Arcade.prototype = {
16991699
}
17001700

17011701
/**
1702-
* Find the angle in radians between a display object (like a Sprite) and a Pointer, taking their x/y and center into account relative to the world.
1702+
* Find the angle in radians between a display object (like a Sprite) and a Pointer,
1703+
* taking their x/y and center into account relative to the world.
17031704
*
17041705
* @method Phaser.Physics.Arcade#worldAngleToPointer
17051706
* @param {any} displayObject - The DisplayObjerct to test from.
17061707
* @param {Phaser.Pointer} [pointer] - The Phaser.Pointer to test to. If none is given then Input.activePointer is used.
1707-
* @return {number} The angle in radians between displayObject.x/y to Pointer.x/y
1708+
* @return {number} The angle in radians between displayObject.world.x/y to Pointer.worldX / worldY
17081709
*/
1709-
worldAngleToPointer: function (displayObject, pointer) {
1710+
worldAngleToPointer: function (displayObject, pointer) {
1711+
17101712
pointer = pointer || game.input.activePointer;
17111713

17121714
var dx = pointer.worldX - displayObject.world.x;
17131715
var dy = pointer.worldY - displayObject.world.y;
17141716

17151717
return Math.atan2(dy, dx);
1718+
17161719
}
17171720

17181721
};

0 commit comments

Comments
 (0)