Skip to content

Commit

Permalink
Merge branch 'point-towards' of https://github.com/tjvr/phosphorus
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan committed Mar 18, 2016
2 parents cb68210 + d389e69 commit f09fa98
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion phosphorus.js
Original file line number Diff line number Diff line change
Expand Up @@ -1651,7 +1651,13 @@ var P = (function() {
x = sprite.scratchX;
y = sprite.scratchY;
}
this.direction = Math.atan2(x - this.scratchX, y - this.scratchY) * 180 / Math.PI;
var dx = x - this.scratchX;
var dy = y - this.scratchY;
if (dx === 0 && dy === 0) {
this.direction = 90;
} else {
this.direction = Math.atan2(dx, dy) * 180 / Math.PI;
}
if (this.saying) this.updateBubble();
};

Expand Down

0 comments on commit f09fa98

Please sign in to comment.