Skip to content

Commit

Permalink
Merge pull request #724 from jotson/dev
Browse files Browse the repository at this point in the history
Math.atan2 calls are using arguments in the wrong order
  • Loading branch information
photonstorm committed Apr 15, 2014
2 parents 563e581 + 2520323 commit d9e5b40
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion src/geom/Line.js
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ Object.defineProperty(Phaser.Line.prototype, "length", {
Object.defineProperty(Phaser.Line.prototype, "angle", {

get: function () {
return Math.atan2(this.end.x - this.start.x, this.end.y - this.start.y);
return Math.atan2(this.end.y - this.start.y, this.end.x - this.start.x);
}

});
Expand Down
4 changes: 2 additions & 2 deletions src/math/Math.js
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ Phaser.Math = {
* @return {number}
*/
angleBetween: function (x1, y1, x2, y2) {
return Math.atan2(x2 - x1, y2 - y1);
return Math.atan2(y2 - y1, x2 - x1);
},

/**
Expand All @@ -347,7 +347,7 @@ Phaser.Math = {
* @return {number}
*/
angleBetweenPoints: function (point1, point2) {
return Math.atan2(point2.x - point1.x, point2.y - point1.y);
return Math.atan2(point2.y - point1.y, point2.x - point1.x);
},

/**
Expand Down

0 comments on commit d9e5b40

Please sign in to comment.