title: Get angle in terms of 360 degrees
body: <p>I would like to get an angle in terms of 360 degrees... for my game, I need to know which direction the player is heading in... </p>
  
  <p><img src="https://i.stack.imgur.com/xlIUS.png" alt="enter image description here"></p>
  
  <p>The code here gets the proper angles, but only in terms of 90 degree increments: (meaning, when I click in upper left quadrant, I get angle from 0 to 90 degrees... bottom left is 0 to -90 degrees, etc...)</p>
  
  <p><img src="https://i.stack.imgur.com/6Vzu6.png" alt="enter image description here"></p>
  
  <pre><code>    var dY = this.pos.y-e.gameY;            //opposite
      var dX = this.pos.x-e.gameX;            //adjacent
      var dist = Math.sqrt((dY*dY)+(dX*dX));  //hypotenuse
      var sin = dY/dist;                      //opposite over hypotenuse
      var radians = Math.asin(sin);
      var degrees = radians*(180/Math.PI);    //convert from radians to degrees
      this.calculatedAngle = degrees;     
  </code></pre>
  
  <p>How can I get it in terms of 360 degrees?</p>
  
  <hr>
  
  <p>Here is another example: The top two represent the issue... when I click in the upper/lower left quadrant, it keeps drawing a right triangle from the x axis...</p>
  
  <p>I need it to be like the lower 2 pictures, where it keeps drawing the angle around:</p>
  
  <p><img src="https://i.stack.imgur.com/xPxn6.png" alt="enter image description here"></p>