Commit adf6543 1 parent 27198da commit adf6543 Copy full SHA for adf6543
File tree 3 files changed +6
-4
lines changed
3 files changed +6
-4
lines changed Original file line number Diff line number Diff line change @@ -107,13 +107,15 @@ Phaser.Point.prototype = {
107
107
* Sets the `x` and `y` values of this Point object from a given polar coordinate.
108
108
*
109
109
* @method Phaser.Point#setToPolar
110
- * @param {number } azimuth - The angular coordinate, in radians.
110
+ * @param {number } azimuth - The angular coordinate, in radians (unless `asDegrees`) .
111
111
* @param {number } [radius=1] - The radial coordinate (length).
112
+ * @param {boolean } [asDegrees=false] - True if `azimuth` is in degrees.
112
113
* @return {Phaser.Point } This Point object. Useful for chaining method calls.
113
114
*/
114
- setToPolar : function ( azimuth , radius ) {
115
+ setToPolar : function ( azimuth , radius , asDegrees ) {
115
116
116
117
if ( radius == null ) { radius = 1 ; }
118
+ if ( asDegrees ) { azimuth = Phaser . Math . degToRad ( azimuth ) ; }
117
119
118
120
return this . setTo ( Math . cos ( azimuth ) * radius , Math . sin ( azimuth ) * radius ) ;
119
121
Original file line number Diff line number Diff line change @@ -1821,7 +1821,7 @@ Phaser.Physics.Arcade.prototype = {
1821
1821
if ( speed === undefined ) { speed = 60 ; }
1822
1822
point = point || new Phaser . Point ( ) ;
1823
1823
1824
- return point . setToPolar ( Phaser . Math . degToRad ( angle ) , speed ) ;
1824
+ return point . setToPolar ( angle , speed , true ) ;
1825
1825
1826
1826
} ,
1827
1827
Original file line number Diff line number Diff line change @@ -3981,7 +3981,7 @@ declare module Phaser {
3981
3981
set ( x : number , y ?: number ) : Phaser . Point ;
3982
3982
setMagnitude ( magnitude : number ) : Phaser . Point ;
3983
3983
setTo ( x : number , y ?: number ) : Phaser . Point ;
3984
- setToPolar ( azimuth : number , radius ?: number ) : Phaser . Point ;
3984
+ setToPolar ( azimuth : number , radius ?: number , asDegrees ?: boolean ) : Phaser . Point ;
3985
3985
subtract ( x : number , y : number ) : Phaser . Point ;
3986
3986
toString ( ) : string ;
3987
3987
You can’t perform that action at this time.
0 commit comments