Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Math.atan2 calls are using arguments in the wrong order #724

Merged
merged 3 commits into from
Apr 15, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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