title: Accelerometer detection and sprite rotation
body: <p>I would like to use the accelerometer to move my player sprite.</p>
  
  <p>If the sprite is going straight and the player tilts a little to the left, the sprite should rotate a little bit to the left, and same for the right. </p>
  
  <p>I also want to detect how much the player has tilted the device and turn the sprite accordingly. </p>
  
  <p>e.g. If the player tilts the device a lot the sprite should rotate 90 degrees rather than 45 for a quick tilt in a direction.</p>
  
  <p>How does one do this. Detect the device movement in any direction, and for a small movement, the sprite should rotate less and for a larger rotation the sprite should rotate more. </p>
  
  <p>I have experimented a little and dont get the results. Some times it works for clockwise rotations to the up, right and down movements, but not for the left movements.</p>
  
  <p>What is the math behind this. An example would be the way a device detects its orientation and rotates the screen.</p>
  
  <p>How does one do this correctly?</p>